pavanarya – Pavan Kumar Aryasomayajulu <br> My New Blog http://xyzcoder.com

Contact Email : pavan.aryasomayajulu@gmail.com

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

3 Responses

Subscribe to comments with RSS.

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

    Genaro B. Rios

    May 4, 2013 at 6:46 am

  2. Using dynamic SQL is the simplest approach from a coding standpoint. The problem with dynamic SQL, though, is that you have to hard parse every distinct version of the query which not only has the potential of taxing your CPU but has the potential to flood your shared pool with lots of non-sharable SQL statements, pushing out statements you’d like to cache, causing more hard parses and shared pool fragmentation errors. If you’re running this once a day, that’s probably not a major concern. If hundreds of people are executing it thousands of times a day, that is likely a major concern.

    Wanda R. Kramer

    May 4, 2013 at 3:14 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: