Anonymous user
Runtime evaluation: Difference between revisions
Added JavaScript example
(Added JavaScript example) |
|||
Line 241:
two = loadstring"return ..." -- two() returns the arguments passed to it</lang>
=={{header|JavaScript}}==
The eval method handles statements and expressions well:
<lang javascript>
var foo = eval('{value: 42}');
eval('var bar = "Hello, world!";');
typeof foo; // 'object'
typeof bar; // 'string'
</lang>
=={{header|Oz}}==
|