Javascript interpolation quiz by agentcooper
Yet another javascript quiz task. Do not hurt your brain too much :-)
Copy of the code for your convenience:
<script>
// your code goes here
</script>
<script>
var a = 3;
z = 5;
(function() {
var a = 3 + 5,
b = a / 2,
str = "Inter" + "polation";
z = z + 1;
res = (a + b + z) * 3;
// will output 'Interpolation: (8 + 4 + 6) * 3 = 54'
console.log('#{str}: (#{a} + #{b} + #{z}) * 3 = #{res}'.interpolate());
}).run();
</script>
Comments
releu commented 6 months ago
what's
.run()?agentcooper commented 6 months ago
You can define your own stuff directly on prototypes.
For example:
releu commented 6 months ago
Guys on reddit are also trying to solve it. http://www.reddit.com/r/javascript/comments/13rsd5/javascript_interpolation_quiz/