Javascropt Eval() function with semi-colon seperated

Rajesh_Kumar
Posted by Rajesh_Kumar under JavaScript category on | Points: 40 | Views : 2199
function use_of_eval_method()
{
eval('40;(20/5);65;90+20');
}


The output of above statement is 110. So point here is if we pass semi-colon separated mathematical expressions to eval function in Javascript then it would return the value of the last evaluated expression. So in our case the answer would be 90+20 = 110.

Comments or Responses

Posted by: Learningtorise on: 2/19/2014 Level:Starter | Status: [Member] | Points: 10

Good One

Login to post response