ES Concept Explanation:
ECMAScript is a European computer Manufacturers Association) by the ECMA International (formerly the European Association of Computer Manufacturers, the English name is ECMA-262 standardized Scripting programming language.
The ECMA-262 specification defines a set of keywords supported by ECMAScript that identifies the beginning of the ECMAScript statement and / or end. By regulation, keywords are reserved and cannot be used as variable names or function names. The following is a complete list of ECMAScript keywords:
Break else new Var typeof
Case finally return void
Catch for switch while
Default if throw delete
In Try do instanceof
If you use a keyword as a variable name or function name, you might get an error message such as "Indetifier expected"(which should have an identifier).
reserved words for ECMA-262
ECMAScript defines a set of reserved words, reserved words that are in some sense reserved for future purposes. Therefore, reserved words cannot be used as variable names or function names. ECMA-262 The complete list of reserved words in version 3 is as follows:
abstract enum int Short
Boolean Export interface static
BYTE extends long super char final
Native Synchronized class float package
Throws const goto Private Transient Debugger
Implements protected volatile double
Import public
If you use a reserved word as a variable or function name, you will likely not receive any error messages unless the reserved word is implemented by the future browser. When the browser implements it, the word is considered to be a keyword, so a keyword error occurs.
1995yearsNetscapepublished by the companyNetscape Navigator 2.0, the release of theSunco-developedJavaScript 1.0and a great success, and the subsequent3.0released in versionJavaScript1.1, when Microsoft entered the browser market,IE 3.0equipped with aJavaScriptthe cloned version-jscript, plusCenviof theScriptease(also a clientscripting language, resulting in the simultaneous presence of three different versions of the Client scripting language. In order to establish the standardization of language,1997yearsJavaScript 1.1submitted as a draft toEuropean Association of Computer Manufacturers (ECMA), the 39th Technical Committee (TC39) was delegated to"standardize the syntax and semantics of a common, cross-platform, vendor-based scripting language". Finally inNetscape,Sun, Microsoft,Borlandwith the participation of the company .ECMA-262, the standard defines what is called aECMAScript's new scripting language.
javscript jscript actionscript Span style= "font-family: the song Body;" The scripting languages are based on ecmascript standard implementation.
So,ECMAScript is actually a syntactic and semantic standard for scripting. JavaScript is actually made up of ECMAScript,DOM , and BOM . So, declaring variables in JavaScript,JScript , and ActionScript , manipulating arrays are identical in syntax, because they are all ECMAScript. However, there are unique methods in manipulating browser objects, which are the extensions of the respective languages.
What has changed in ECMAScript?
Since the release of the third edition,ECMAScript has been widely used because of its association with the World Wide Web, which has essentially become A programming language available to all Web browsers. In order to compile the fourth edition of ECMAScript, people do a lot of work. Although the work was not completed and the fourth edition of the standard was not published, it facilitated the evolution of the language. ECMAScript version fifth (released as ECMA-262 5th edition) has incorporated many of the language specification resolutions that have in fact been developed in the browser implementation, and added support for new features that have emerged since the third release. These new features include accessor properties, reflection creation and object detection, programmatic control of attribute properties, new array manipulation functions,JSON Object encoding formats, and strict patterns that provide improved error checking and program security.
What's new in ES5
ES5 in general, the changes are very few, the most important is the following changes:
Use Strict
This function can be declared in strict mode by a string syntax in the first line of the function definition
function () {
"Use strict";
}
In strict mode, there are some limitations:
- An undeclared variable is assigned a direct error instead of becoming a global variable.
- The function default this will become undefined instead of the default point to Window
- Write to read-only properties, delete non-deleted properties, and add properties to non-expanding objects throws an exception
- Prohibit using with statements
- The name of the attribute will be error, the name of the function parameter will be error
JSON Support
Json.parse and json.stringify are supported by default
Objects and Properties
You can now set the Getter setter on the properties of an object:
var obj = {};
Object.defineproperty (obj, "name", {
Get:function () {
return Name.touppercase ();
},
Set:function (n) {
Name=n;
}
})
You can define whether an object's properties can be modified, can be deleted, or can be added:
Object.defineproperty (obj, "value", {
Value:true,
Writable:false,
Enumerable:true,
Configurable:true
});
You can now freeze an object directly, freezing in two ways:
- Object.seal (obj), which makes the object's property configuration configuration impossible to modify, is equivalent to setting each property to Configurale=false
- Object.freeze (obj), in addition to seal, will also be the property value itself cannot be modified, equivalent to each property at the same time Configurable=false and Writable=false
It is now easier to traverse the properties of an object:
- Object.getownpropertynames
- Object.keys
new methods for arrays
The following commonly used methods are added to the array:
- Map
- Every
- Filter
- Foreach
- IndexOf
- Reduce
- Reduceright
- Some
So you can safely write the following code:
[1,2,3].map (function (a) {return a*a;})
REFERENCE
1. ecmascript_ Baidu Encyclopedia
2. http://www.zhangxinxu.com/wordpress/?p=3220
3. http://www.zhangxinxu.com/wordpress/?p=2148
Talking about ES5