I'm reading through the ECMA Script 2015 specification.
Under functions I see:
In addition to its properties, a function contains executable code and state that determine how it behaves when invoked. A function’s code may or may not be written in ECMAScript (emphasis added).
Under what circumstances would a function's code not be written in ECMA script?
It's a new feature that introduced in ES6 and is called arrow function. The left part denotes the input of a function and the right part the output of that function.
The function* declaration ( function keyword followed by an asterisk) defines a generator function, which returns a Generator object.
JavaScript is a general-purpose scripting language that conforms to the ECMAScript specification. The ECMAScript specification is a blueprint for creating a scripting language. JavaScript is an implementation of that blueprint. On the whole, JavaScript implements the ECMAScript specification as described in ECMA-262.
ECMAScript, also known as JavaScript, is a programming language adopted by the European Computer Manufacturer's Association as a standard for performing computations in Web applications. ECMAScript is the official client-side scripting language of VoiceXML.
The native functions provided by the execution environment (like the String and Array classes, or setTimeout, or the browser DOM) are frequently written (or powered by other functions written) in C.
Under what circumstances would a function's code not be written in ECMA script?
Core functions provided by the JavaScript engine. E.g. Array.prototype.find:
> Array.prototype.find
find() { [native code] }
For example V8, Chrome's JavaScript engine, is implement in C++, so that method is implemented in C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With