Answer Posted / negi
The eval() function evaluates a string and executes it as if
it was script code.
In this example we use eval() on some strings and see what
it returns:
<script type="text/javascript">
eval("x=10;y=20;document.write(x*y)");
document.write("<br />");
document.write(eval("2+2"));
document.write("<br />");
var x=10;
document.write(eval(x+17));
document.write("<br />");
</script>
The output of the code above will be:
200
4
27
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is javascript? List some data types supported by javascript?
What is a closure in javascript?
Difference between undefined and undeclared variables?
How do you declare in javascript?
Name some of the Javascript frameworks?
What is viewstate in javascript?
Is it possible make a call to server side event of any button using javascript?
What is the concept of “functions as objects” and how does this affect variable scope?
What is context in javascript?
Is javascript open source?
What's the date object using javascript?
What are the decodeURI() and encodeURI()?
What is event in web programming?
what will happen and why if i will acess the methods of superclass which is declared as private by a object of same subclass.
What coding language should I learn first?