In JavaScript, the eval function evaluates a string as if it were JavaScript code. The return value is the result of the evaluated string, e.g. eval('2 + 2') returns 4.
eval is available in the global scope. The lexical scope of the evaluation is the local scope unless invoked indirectly (e.g. var ...