Answer:
The 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
<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
Previous Question | Next Question |
How to associate functions with objects using JavaScript? | What does break and continue statements do in JavaScript? |