Javascript Eval() Function

As its name indicates, Javascript eval function is used to execute javascript source code.

Note: Use of eval method is not advised for the following reasons:

  • security risk
  • difficult to debug
  • creates a new instance of Javascript interpreter on each invocation of eval()

Syntax

Javascript Eval() Function Example