pavanarya

Let us share the knowledge

Eval() with multiple mathematical expressions seperated by semi-colon

with 3 comments

Came across an interesting thing today

eval(’25;(100/10);40;30+40′) What will be the output of this javascript statement.

The output of above statement is 70. 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 30+40 ie 70.

Isn’t it  really cool……..:)

Written by pavanarya

April 22, 2013 at 9:48 pm

Posted in Asp.net

Tagged with

Follow

Get every new post delivered to your Inbox.

Join 67 other followers

%d bloggers like this: