Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Eval
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== ECMAScript === ==== JavaScript ==== In [[JavaScript]], <code>eval</code> is something of a hybrid between an expression evaluator and a statement executor. It returns the result of the last expression evaluated. Example as an expression evaluator: <syntaxhighlight lang="javascript"> foo = 2; alert(eval('foo + 2')); </syntaxhighlight> Example as a statement executor: <syntaxhighlight lang="javascript"> foo = 2; eval('foo = foo + 2;alert(foo);'); </syntaxhighlight> One use of JavaScript's <code>eval</code> is to parse [[JSON]] text, perhaps as part of an [[Ajax (programming)|Ajax]] framework. However, modern browsers provide <code>JSON.parse</code> as a more secure alternative for this task. ==== ActionScript ==== In [[ActionScript]] (Flash's programming language), <code>eval</code> cannot be used to evaluate arbitrary expressions. According to the Flash 8 documentation, its usage is limited to expressions which represent "the name of a variable, property, object, or movie clip to retrieve. This parameter can be either a String or a direct reference to the object instance."<ref>{{cite web |url = http://livedocs.macromedia.com/flash/8/index.html |archive-url = https://web.archive.org/web/20061010123451/http://livedocs.macromedia.com/flash/8/index.html |url-status = dead |archive-date = October 10, 2006 |title = Flash 8 LiveDocs |date = October 10, 2006}}</ref> ActionScript 3 does not support eval. The ActionScript 3 Eval Library<ref>[http://eval.hurlant.com ActionScript 3 Eval Library]</ref> and the D.eval API<ref>{{cite web |url=http://www.riaone.com/products/deval/ |title=The D.eval API |archive-url=https://web.archive.org/web/20130314012753/http://www.riaone.com/products/deval/ |archive-date=March 14, 2013 |url-status=dead}}</ref> were development projects to create equivalents to <code>eval</code> in ActionScript 3. Both have ended, as [[Adobe Flash Player]] has reached its [[End-of-life_product|end-of-life]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)