ECMAScript: Difference between revisions

Content deleted Content added
No edit summary
m Reverting possible vandalism by 41.45.154.190 to version by MSWS. Report False Positive? Thanks, ClueBot NG. (4412224) (Bot)
 
(25 intermediate revisions by 23 users not shown)
Line 5:
| designer = [[Brendan Eich]], [[Ecma International]]
| typing = [[weak typing|weak]], [[dynamic typing|dynamic]]
| implementations = [[JavaScript]], [[ActionScript]], [[JScript]], [[QtScript]], [[InScript (JavaScript engine)|InScript]], [[Google Apps Script]]
| website = {{URL|https://www.ecma-international.org/publications-and-standards/standards/ecma-262/}}
| year = {{Start date and age|1997}}
Line 23:
| owner = [[Sun Microsystems]],<br/>[[Ecma International]]
| released = {{Start date and age|1997|06}}
| latest release version = Edition 1415
| latest release date = {{start date and age|20232024|06}}
| genre = [[Scripting language]]
| container for =
Line 48:
|archive-url = https://web.archive.org/web/20160610005241/https://books.google.com/books?id=WTZqecc9olUC
|url-status = live
}}</ref> is a standard for scripting languages, including [[JavaScript]], [[JScript]], and [[ActionScript]]. It is best known as a JavaScript standard intended to ensure the [[interoperability]] of [[web page]]s across different [[web browser]]s.<ref>{{cite journal |last1=Wirfs-Brock |first1=Allen |last2=Eich |first2=Brendan |date=2020-05-02 |year=2020 |title=JavaScript: The First 20 Years |journal=Proceedings of the ACM on Programming Languages |volume=4 |issue=HOPL |pages=1–189 |doi=10.1145/3386327 |doi-access=free |s2cid=219603695}}</ref> It is standardized by [[Ecma International]] in the document [https://www.ecma-international.org/publications-and-standards/standards/ecma-262/ ECMA-262].
 
ECMAScript is commonly used for [[client-side scripting]] on the [[World Wide Web]], and it is increasingly being used for server-side applications and services using runtime environments -such as [[Node.js]],<ref>{{cite web|last=Wunder|first=C.|url=https://nodejs.org/en/docs/es6 | title=Node.js — ECMAScript 2015 (ES6) and beyond|website=Node.js}}</ref>, [[Deno (software)|denoDeno]]<ref>{{cite web | url=https://www.infoworld.com/article/3644460/deno-joins-javascript-standards-effort.html | title=Deno joins JavaScript standards effort | date=14 December 2021 }}</ref> and [[Bun (software)|bunBun]].<ref>https://bun.sh/docs#:~:text=or%2C%20more%20formally%2C-,ECMAScript,-)%20is%20just%20a bun</ref>.
 
== ECMAScript, ECMA-262, JavaScript ==
'''ECMA-262''', or the ''ECMAScript Language Specification'', defines the ''ECMAScript Language'', or just '''ECMAScript'''.<ref>{{cite web |last=Guo |first=Shu-yu |date=2022-02-14 |title=ECMAScriptÂŽ 2022 Language Specification |url=https://tc39.es/ecma262/ |url-status=live |archive-url=https://web.archive.org/web/20200508053013/https://tc39.es/ecma262/ |archive-date=2020-05-08 |website=tc39.es |publisher=Tc39.es |accessdate=2022-02-14}}</ref> ECMA-262 specifies only language syntax and the semantics of the core application programming interface ([[API]]), such as {{mono|Array}}, {{mono|Function}}, and {{mono|globalThis}}, while valid implementations of JavaScript add their own functionality such as [[input/output]] and [[file system]] handling.
 
== History==
The ECMAScript specification is a standardized specification of a scripting language developed by [[Brendan Eich]] of [[Netscape Communications Corporation|Netscape]]; initially named Mocha, then LiveScript, and finally JavaScript.<ref>{{cite web |last=Krill |first=Paul |date=2008-06-23 |title=JavaScript creator ponders past, future |url=http://www.infoworld.com/article/2653798/application-development/javascript-creator-ponders-past--future.html |url-status=live |archive-url=https://web.archive.org/web/20140920141040/http://www.infoworld.com/article/2653798/application-development/javascript-creator-ponders-past--future.html |archive-date=2014-09-20 |access-date=2013-10-31 |website=infoworld.com |publisher=InfoWorld}}</ref> In December 1995, [[Sun Microsystems]] and Netscape announced JavaScript in a press release.<ref>{{cite web |date=1995-12-04 |title=Netscape and Sun announce JavaScript, the Open, Cross-platform Object Scripting Language for Enterprise Networks and the Internet |url=http://wp.netscape.com/newsref/pr/newsrelease67.html |url-status=dead |archive-url=https://web.archive.org/web/20020606002913/http://wp.netscape.com/newsref/pr/newsrelease67.html |archive-date=2002-06-06 |access-date=2019-11-04 |website=Netscape.com |publisher=Netscape}}</ref> In November 1996, Netscape announced a meeting of the [[Ecma International]] standards organization to advance the standardization of JavaScript.<ref>{{cite web |last=Press Release |date=November 15, 1996 |title=Industry Leaders to Advance Standardization of Netscape's JavaScript at Standards Body Meeting |url=http://cgi.netscape.com/newsref/pr/newsrelease289.html |url-status=dead |archive-url=https://web.archive.org/web/19981203070212/http://cgi.netscape.com/newsref/pr/newsrelease289.html |archive-date=1998-12-03 |access-date=2013-10-31 |website=Netscape.com |publisher=Netscape}}</ref> <!-- Should add that Jscript is also from EMCAScript -->The first edition of ECMA-262 was adopted by the Ecma General Assembly in June 1997. Several editions of the language standard have been published since then. The name "ECMAScript" was a compromise between the organizations involved in standardizing the language, especially Netscape and Microsoft, whose disputes dominated the early standards sessions. Eich commented that "ECMAScript was always an unwanted trade name that sounds like a [[eczema|skin disease]]."<ref>{{cite web |last=Eich |first=Brendan |date=2006-10-03 |title=Will there be a suggested file suffix for es4? |url=https://mail.mozilla.org/pipermail/es-discuss/2006-October/000133.html |url-status=live |archive-url=https://web.archive.org/web/20200621202321/https://mail.mozilla.org/pipermail/es-discuss/2006-October/000133.html |archive-date=2020-06-21 |access-date=2021-05-05 |website=mozilla.org |publisher=Mail.mozilla.org}}</ref> ECMAScript has been formalized through [[operational semantics]] by work at [[Stanford University]] and the [[Department of Computing, Imperial College London|Department of Computing]], [[Imperial College London]] for security analysis and standardization.<ref>{{cite web |last1=Maffeis |first1=Sergio |last2=Mitchell |first2=John C. |last3=Taly |first3=Ankur |date=2020-01-03 |title=An Operational Semantics for JavaScript |url=http://theory.stanford.edu/people/jcm/papers/aplas08-camera-ready.pdf |url-status=live |archive-url=https://web.archive.org/web/20200103204704/http://theory.stanford.edu/people/jcm/papers/aplas08-camera-ready.pdf |archive-date=2020-01-03 |access-date=2020-01-03 |website=stanford.edu |publisher=[[Association for Computing Machinery]]}}</ref>
"ECMA" stood for "European Computer Manufacturers Association" until 1994.
 
===Version historyEvolution===
{{Main|ECMAScript version history}}
Ecma's Technical Committee 39 (TC39) is responsible for the maintenance of ECMAScript.<ref>{{Citation |title=TC39 |work=Technical Committees |url=https://ecma-international.org/technical-committees/tc39 |access-date=2024-08-11 |publisher=Ecma International |language=en-US}}</ref> New proposals to the language go through a staged process, with each stage representing the completeness of the proposal's specification. Consensus must be reached within the committee to advance a proposal to the next stage. Proposals that reach stage 4, the final stage, will be included into the next version of the standard.<ref>{{Citation |title=The TC39 Process |work=TC39 |url=https://tc39.es/process-document |access-date=2024-08-11 |publisher=Ecma International}}</ref> Since the release of version 6 in June 2015, new major versions have been finalized and published every June.<ref>{{Citation |title=ECMAScript, TC39, and the History of JavaScript |work=ui.dev |url=https://ui.dev/ecmascript |access-date=2024-08-11}}</ref>
 
== Features ==
{{expand section|date=February 2017}}
<!-- Could be expanded using the Javascript article -->{{main|ECMAScript syntax|JavaScript#Features}}
The ECMAScript language includes [[structured programming|structured]], [[dynamic programming language|dynamic]], [[functional programming|functional]], and [[prototype-based programming|prototype-based]] features.<ref>{{cite web |url=http://www.ecmascript.org/about.php |title=About |publisher=ECMAScript |access-date=2009-12-17 |url-status=dead |archive-url=https://archive.today/20120802115457/http://www.ecmascript.org/about.php |archive-date=2012-08-02 }}</ref>
 
=== Imperative and structured ===
ECMAScript JavaScript<!-- How to make clearer? --> supports [[C (programming language)|C]]-style structured programming. Previously, JavaScript only supported [[Scope (computer science)|function scoping]] using the keyword <code>var</code>, but ECMAScript 2015 added the keywords <code>let</code> and <code>const</code>, allowing JavaScript to support both block scoping and function scoping. JavaScript supports [[automatic semicolon insertion]], meaning that semicolons that normally terminate a statement in C may be omitted in JavaScript.<!-- Might imply EMCAScript doesn't support automatic semicolon insertion --><ref name="Flanagan2006">{{cite book|url=https://books.google.com/books?id=2weL0iAfrEMC|title=JavaScript: The Definitive Guide: The Definitive Guide|authorfirst=David |last=Flanagan|edition=5th|date=17 August 2006|publisher="O'Reilly Media, Inc."|isbn=978-0-596-5544710199-72|page=16|access-date=11 November 2019|archive-date=1 August 2020|archive-url=https://web.archive.org/webdetails/20200801065235/https://books.google.com/books?id=2weL0iAfrEMCjavascriptdefini0000flan|url-statusaccess=liveregistration}}</ref>
 
Like C-style languages, [[control flow]] is done with the {{Code|code=while}}, {{Code|code=for}}, {{Code|code=do}} / {{Code|code=while}}, {{Code|code=if}} / {{Code|code=else}}, and {{Code|code=switch}} statements.<!-- missing Labels / Functions --> Functions are weakly typed and may accept and return any type. Arguments not provided default to {{Code|code=undefined}}.
 
=== Weakly typed ===
ECMAScript is [[weakly typed]]. This means that certain types are assigned implicitly based on the operation being performed. However, there are several quirks in JavaScript's implementation of the conversion of a variable from one type to another. These quirks have been the subject of a <!-- humorous --> talk entitled ''Wat''.<ref>{{cite conference |last1=Bernhardt |first1=Gary |title=Wat |url=https://www.destroyallsoftware.com/talks/wat |website=Destroy All Software |conference=CodeMash 2012 |access-date=2021-08-18 |archive-date=2019-10-28 |archive-url=https://web.archive.org/web/20191028204723/https://www.destroyallsoftware.com/talks/wat |url-status=live }}</ref><ref>{{cite magazine |last1=Gilbertson |first1=Scott |title=Jokes for Nerds: Wat Moments in Programming |url=https://www.wired.com/2012/01/jokes-for-nerds-wat-moments-in-programming/ |access-date=22 August 2021 |magazine=Wired |date=26 January 2012 |archive-date=23 August 2020 |archive-url=https://web.archive.org/web/20200823123837/https://www.wired.com/2012/01/jokes-for-nerds-wat-moments-in-programming/ |url-status=live }}</ref>
 
=== Dynamic ===
Line 96 ⟶ 97:
! scope="col" colspan="4" | Conformance<ref>ES5 is the baseline for this test suite. The conformance rate for other editions reflects support for new features only, not a comprehensive score.</ref>
|-
!scope="col" | ES5<ref name="kangax5">{{cite web |urldate=https://kangax.github.io/compat2024-table/es504-14 |title=ECMAScript 5 compatibility table |websiteurl=kangaxhttps://compat-table.github.io|language=en|access-date=2018-11/compat-08table/es5/ |archiveurl-datestatus=2018-11-19live |archive-url=https://web.archive.org/web/2018111914515120240114035054/httphttps://kangaxcompat-table.github.io/compat-table/es5/ |urlarchive-statusdate=live2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref>
!scope="col" | ES6 (2015)<ref name="kangax6">{{cite web |urldate=https://kangax.github.io/compat2024-table/es604-14 |title=ECMAScript 6 compatibility table |websiteurl=kangaxhttps://compat-table.github.io|language=en|access-date=2018-11/compat-08table/es6/ |archiveurl-datestatus=2018-11-17live |archive-url=https://web.archive.org/web/2018111719402720240404212624/httphttps://kangaxcompat-table.github.io/compat-table/es6/ |urlarchive-statusdate=live2024-04-04 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref>
!scope="col" | ES7 (2016)ES2016+<ref name="kangax2016plus">{{cite web |urldate=https://kangax.github.io/compat2024-table/es2016plus04-14 |title=ECMAScript 2016+ compatibility table |websiteurl=kangaxhttps://compat-table.github.io|language=en|access/compat-date=2018-11-08table/es2016plus/ |archiveurl-datestatus=2018-11-24live |archive-url=https://web.archive.org/web/2018112411295420240114034945/httphttps://kangaxcompat-table.github.io/compat-table/es2016plus/ |urlarchive-statusdate=live2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io |language=en}}</ref>
!scope="col" | Newer (2017+)Next<ref>{{Cite nameweb |date="kangax2016plus"2024-04-14 |title=ECMAScript Next compatibility table |url=https://compat-table.github.io/compat-table/esnext/ |url-status=live |archive-url=https://web.archive.org/web/20240114035113/https://compat-table.github.io/compat-table/esnext/ |archive-date=2024-01-14 |access-date=2024-04-14 |website=compat-table.github.io}}</ref><ref>Composite score that includes new features from ES7 through next edition drafts</ref>
|-
!scope="row" | [[SpiderMonkey]]
| [[Firefox]] 94120
| 100% || 98% || 10098% || 1005%
|-
!scope="row" | [[V8 (JavaScript engine)|V8]]
| [[Google Chrome]] 95117, [[Microsoft Edge]] 95113, [[Opera (web browser)|Opera]] 8098
| 100% || 98% || 10098% || 1005%
|-
!scope="row" | [[JavaScriptCore]]
| [[Safari (web browser)|Safari]] 1517
| 10099% || 99100% || 10098% || 9011%
|}
 
Line 121 ⟶ 122:
{{Reflist|colwidth=30em}}
 
{{-Clear}}
{{ECMAScript}}
{{Ecma International Standards}}
Line 127 ⟶ 128:
{{List of IEC standards}}
 
[[Category:Computer-related introductions in 1997]]
[[Category:C programming language family]]
[[Category:Computer standards]]
[[Category:Dynamically typed programming languages]]
[[Category:Ecma standards]]
[[Category:JavaScript dialect engines]]
[[Category:JavaScript programming language family]]
[[Category:Object-based programming languages]]
[[Category:Programming languages with an ISO standard]]
[[Category:Prototype-based programming languages]]
[[Category:Scripting languages]]
[[Category:Source-to-source compilers]]