What is the use of eval() in javascript ?

 Posted by Bharathi Cherukuri on 7/11/2012 | Category: JavaScript Interview questions | Views: 2828 | Points: 40

The eval() method is allows you to execute code snippets during execution.


<script type="text/javascript">
var USA_Texas_Austin = "521,289";
document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
This produces
Population is 521,289

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response