eval

How does javascript eval handle 'this'

I ran tests in Firefox 3.6.11, if that matters, and eval misbehaves in the context of call and apply. It somehow jumps over the current 'this' object. Why? dojo.provide("yal-js.tests.javascript"); function evaltest () { var dis=this; // it works now... returns 2 on call and apply return eval("(function() {return this.testVa...

why JavaScript is not displaying parsed json data?

This is format of JSON data: [{"options":"smart_exp"},{"options":"user_int"},{"options":"blahblah"}] that I receive through getjson from server. I need to append json with user input. I am trying to do it in this way: 1st convert it into javascript object, append it with user input, again convert to json object & send it back to server f...

Codegeneration vs text string evaluation

What are the advantages and disadvantages of the following approaches to the management of repetitive code: 1) Use exec(), eval(), and similar functions in other languages for Keyword in KeywordsUpperCase: exec(Keyword + " = \"" + Keyword.lower() + "\"") 2) Use external code generator which uses its own language (which is interle...