What is eval() in JavaScript?
Submitted by: AdministratorThe eval() method is incredibly powerful allowing us to execute snippets of code during execution in JavaScript.
<script type="text/javascript">
var USA_Texas_Austin = "521,289";
document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
</script>
This produces
Population is 521,289
Submitted by: Administrator
<script type="text/javascript">
var USA_Texas_Austin = "521,289";
document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
</script>
This produces
Population is 521,289
Submitted by: Administrator
Read Online JavaScript Job Interview Questions And Answers
Top JavaScript Questions
☺ | Does JavaScript have the concept level scope? |
☺ | How to get the contents of an input box using JavaScript? |
☺ | How do you convert numbers between different bases in JavaScript? |
☺ | Are Java and JavaScript the Same? |
☺ | How to use "join()" to create a string from an array using JavaScript? |
Top Top World Wide Web Categories
☺ | Cascading Style Sheet CSS Interview Questions. |
☺ | HTML5 Interview Questions. |
☺ | Basic Internet Interview Questions. |
☺ | Domain Name System (DNS) Interview Questions. |
☺ | JavaScript Interview Questions. |