JavaScript syntax: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 1,666:
 
===eval (expression) ===
Evaluates expressionthe stringfirst parameter as an expression, which can include assignment statements. Variables local to functions can be referenced by the expression. However, the {{code|eval}} represents a major security risk, as it allows a bad actor to execute arbitrary code, and so its use is discouraged.<ref name="deve_eval">{{Cite web |title=eval() |work=MDN Web Docs |access-date=29 January 2020 |url= https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#Never_use_eval!}}</ref>
<syntaxhighlight lang="javascript">
(function foo() {