Question:

Explain how the eval operator works and give an example of its usage, and describe how the eval operator works in strict mode.


What eval does is evaluate a javascript string such as “4 + 5” will return 9.

  eval('4+5') // returns 9 

It’s not a good idea to use eval because it can introduce malicious code to your users. There are better alternative to using eval. In strict mode it will be tamed somewhat and not be allowed to introduce variables to the global scope.