davej Posted December 26, 2013 Share Posted December 26, 2013 So when does eval() have a legitimate and perfectly safe usefulness? http://stackoverflow.com/questions/86513/why-is-using-the-javascript-eval-function-a-bad-idea Link to comment Share on other sites More sharing options...
Ingolme Posted December 26, 2013 Share Posted December 26, 2013 I don't think a good program would ever need to use it. Except maybe browser that don't support JSON.parse(), but I did build my own JSON.parse() function once just for the experience in order to avoid the use of eval(). Actionscript used to have eval() and they removed it in ActionScript 3, so they know eval is useless. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 6, 2014 Share Posted January 6, 2014 For some things we have our server sending blocks of Javascript code to the browser, that's really the only time I would use it. Eval is better in that situation than creating a new script element with the code and adding it to the page. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now