JavaScript syntax: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile app edit iOS app edit
BobEret (talk | contribs)
eval (expression): Added information about the security risk represented by eval
Line 1,657:
 
===eval (expression) ===
Evaluates expression string parameter, 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() |author= |work=MDN Web Docs |date= |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() {