ECMAScript
Կաղապար:Short description Կաղապար:Infobox programming language Կաղապար:Infobox file format
ECMAScript (/ˈɛkməskrɪpt/; ES)[1] ստանդարտ է սկրիպտային լեզուների համար, ներառյալ JavaScript, JScript և ActionScript: Այն առավել հայտնի է որպես JavaScript ստանդարտ, որը նախատեսված է տարբեր վեբ բրաուզերների միջև վեբ էջերի փոխգործունակությունն ապահովելու համար: Այն ստանդարտացված է Ecma International-ի կողմից ECMA-262 փաստաթղթում:
ECMAScript-ը սովորաբար օգտագործվում է Համաշխարհային ցանցում (WWW) հաճախորդի կողմից սկրիպտավորման համար, և այն ավելի ու ավելի է օգտագործվում սերվերի կողմի հավելվածների և ծառայությունների համար, որոնք օգտագործում են գործարկման ժամանակի միջավայրեր՝ Node.js[2] deno[3] և bun.[4] :
ECMAScript, ECMA-262, JavaScript
ECMA-262-ը կամ ECMAScript լեզվի հստակեցումը սահմանում է ECMAScript լեզուն կամ պարզապես ECMAScript-ը: ECMA-262-ը սահմանում է միայն լեզվի շարահյուսությունը և հիմնական հավելվածի ծրագրավորման միջերեսի (API) իմաստաբանությունը, ինչպիսիք են Array, Function, և globalThis , մինչդեռ JavaScript-ի վավեր իրականացումներն ավելացնում են իրենց սեփական գործառույթները, ինչպիսիք են մուտքային/ելքային և ֆայլային համակարգի մշակումը:
Պատմություն
ECMAScript հստակեցումը սկրիպտային լեզվի ստանդարտացված ճշգրտում է, որը մշակվել է Netscape-ից Բրենդան Էյխի կողմից; սկզբում կոչվում էր Mocha, ապա LiveScript և վերջում JavaScript: 1995 թվականի դեկտեմբերին Sun Microsystems-ը և Netscape-ը հայտարարեցին JavaScript-ը մամուլի հաղորդագրության մեջ։ 1996 թվականի նոյեմբերին Netscape-ը հայտարարեց Ecma International ստանդարտների կազմակերպության հանդիպման մասին՝ JavaScript-ի ստանդարտացումը առաջ մղելու համար: ECMA-262-ի առաջին հրատարակությունն ընդունվել է Ecma-ի Գլխավոր ասամբլեայի կողմից 1997 թվականի հունիսին: Այդ ժամանակվանից ի վեր հրատարակվել են լեզվի ստանդարտի մի քանի հրատարակություններ: «ECMAScript» անվանումը փոխզիջում էր լեզվի ստանդարտացման մեջ ներգրավված կազմակերպությունների, հատկապես Netscape-ի և Microsoft-ի միջև, որոնց վեճերը գերակշռում էին ստանդարտների վաղ նիստերում: Էյխը մեկնաբանեց, որ «ECMAScript-ը միշտ անցանկալի ապրանքային անուն էր, որը հնչում է որպես մաշկային հիվանդություն»: ECMAScript-ը ֆորմալացվել է գործառնական իմաստաբանության միջոցով՝ աշխատելով Սթենֆորդի համալսարանում և Լոնդոնի Կայսերական քոլեջի Հաշվիչների բաժնում՝ անվտանգության վերլուծության և ստանդարտացման համար: «ECMA»-ն մինչև 1994 թվականը եղել է «Եվրոպական համակարգչային արտադրողների ասոցիացիա»:
Features
The ECMAScript language includes structured, dynamic, functional, and prototype-based features.[5]
Imperative and structured
ECMAScript JavaScript supports C-style structured programming. Previously, JavaScript only supported function scoping using the keyword var
, but ECMAScript 2015 added the keywords let
and const
, 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.[6]
Like C-style languages, control flow is done with the
, while
, for
/ do
, while
/ if
, and else
statements. Functions are weakly typed and may accept and return any type. Arguments not provided default to switch
.
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 talk entitled Wat.[7][8]
Dynamic
ECMAScript is dynamically typed. Thus, a type is associated with a value rather than an expression. ECMAScript supports various ways to test the type of objects, including duck typing.[9]
Transpiling
Since ES 2015, transpiling JavaScript has become very common. Transpilation is a source-to-source compilation in which newer versions of JavaScript are used, and a transpiler rewrites the source code so that it is supported by older browsers. Usually, transpilers transpile down to ES3 to maintain compatibility with all versions of browsers. The settings to transpile to a specific version can be configured according to need. Transpiling adds an extra step to the build process and is sometimes done to avoid needing polyfills. Polyfills create new features for older environments that lack them. Polyfills do this at runtime in the interpreter, such as the user's browser or on the server. Instead, transpiling rewrites the ECMA code itself during the build phase of development before it reaches the interpreter.
Conformance
In 2010, Ecma International started developing a standards test for Ecma 262 ECMAScript.[10] Test262 is an ECMAScript conformance test suite that can be used to check how closely a JavaScript implementation follows the ECMAScript Specification. The test suite contains thousands of individual tests, each of which tests some specific requirement(s) of the ECMAScript specification. The development of Test262 is a project of the Ecma Technical Committee 39 (TC39). The testing framework and the individual tests are contributed to Ecma by member organizations of TC39.
Important contributions were made by Google (Sputnik test suite) and Microsoft, who both contributed thousands of tests. The Test262 test suite consisted of 014 tests as of Հունվարի 2020 38[update].[11] ECMAScript specifications through ES7 are well-supported in major web browsers. The table below shows the conformance rate for current versions of software with respect to the most recent editions of ECMAScript.
Scripting engine | Reference application(s) | Conformance[12] | |||
---|---|---|---|---|---|
ES5[13] | ES6 (2015)[14] | ES2016+[15] | Next[16][17] | ||
SpiderMonkey | Firefox 120 | 100% | 98% | 98% | 5% |
V8 | Google Chrome 117, Microsoft Edge 113, Opera 98 | 100% | 98% | 98% | 5% |
JavaScriptCore | Safari 17 | 99% | 100% | 98% | 11% |
See also
References
- ↑ Stefanov, Stoyan (2010). JavaScript Patterns. O'Reilly Media, Inc. էջ 5. ISBN 9781449396947. Արխիվացված օրիգինալից 2016-06-10-ին. Վերցված է 2016-01-12-ին. «The core JavaScript programming language [...] is based on the ECMAScript standard, or ES for short.»
- ↑ «Node.js — ECMAScript 2015 (ES6) and beyond».
- ↑ «Deno joins JavaScript standards effort». 14 December 2021.
- ↑ https://bun.sh/docs#:~:text=or%2C%20more%20formally%2C-,ECMAScript,-)%20is%20just%20a bun
- ↑ «About». ECMAScript. Արխիվացված է օրիգինալից 2012-08-02-ին. Վերցված է 2009-12-17-ին.
- ↑ David Flanagan (17 August 2006). JavaScript: The Definitive Guide: The Definitive Guide. "O'Reilly Media, Inc.". էջ 16. ISBN 978-0-596-55447-7. Արխիվացված օրիգինալից 1 August 2020-ին. Վերցված է 11 November 2019-ին.
- ↑ Bernhardt, Gary. Wat. CodeMash 2012. Destroy All Software. Արխիվացված օրիգինալից 2019-10-28-ին. Վերցված է 2021-08-18-ին.
- ↑ Gilbertson, Scott (26 January 2012). «Jokes for Nerds: Wat Moments in Programming». Wired. Արխիվացված օրիգինալից 23 August 2020-ին. Վերցված է 22 August 2021-ին.
- ↑ «JavaScript data types and data structures – JavaScript | MDN». Developer.mozilla.org. 2017-02-16. Արխիվացված օրիգինալից 2017-03-14-ին. Վերցված է 2017-02-24-ին.
- ↑ «ECMAScript Language – test262». Test262.ecmascript.org. Արխիվացված է օրիգինալից 2011-05-14-ին. Վերցված է 2013-10-31-ին.
- ↑ «tc39/test262». GitHub. January 24, 2020. Արխիվացված օրիգինալից October 1, 2019-ին. Վերցված է January 29, 2020-ին.
- ↑ ES5 is the baseline for this test suite. The conformance rate for other editions reflects support for new features only, not a comprehensive score.
- ↑ «ECMAScript 5 compatibility table». compat-table.github.io (անգլերեն). 2024-04-14. Արխիվացված օրիգինալից 2024-01-14-ին. Վերցված է 2024-04-14-ին.
- ↑ «ECMAScript 6 compatibility table». compat-table.github.io (անգլերեն). 2024-04-14. Արխիվացված օրիգինալից 2024-04-04-ին. Վերցված է 2024-04-14-ին.
- ↑ «ECMAScript 2016+ compatibility table». compat-table.github.io (անգլերեն). 2024-04-14. Արխիվացված օրիգինալից 2024-01-14-ին. Վերցված է 2024-04-14-ին.
- ↑ «ECMAScript Next compatibility table». compat-table.github.io. 2024-04-14. Արխիվացված օրիգինալից 2024-01-14-ին. Վերցված է 2024-04-14-ին.
- ↑ Composite score that includes new features from ES7 through next edition drafts
Կաղապար:ECMAScript Կաղապար:Ecma International Standards Կաղապար:ISO standards Կաղապար:List of IEC standards