1. JavaScript subset
The definition of a subset of JavaScript is mostly for security reasons, and only a secure subset of the language is used to write scripts that enable the code to run more securely and stably. For example, how to run a more secure ad code that is provided by untrusted third parties. A subset of JavaScript generally removes some of the features of JavaScript. such as Adsafe, Dojox.secure, Caja, FBJS, and Microsoft's Web sandbox, all of these implement a security subset.
2. Constants and Local variables
Constants are represented by Const. A local variable is represented by let, which declares a block-level scope. The out-of-scope variable is invalid.
3. Deconstruction Assignment
The deconstruction assignment is a hybrid assignment, a concept in Python that looks directly at the following examples:
let [x, y] = [12let12;
4. iterators
Iterators use methods similar to Python, iterators must include the next () method, and for an iterative object, a method called d__iterator__ () must be defined.
5. Generator
Generator, using the same method as the Python,yield keyword for production, there are two methods, next () and send ().
6. Array derivation
The array derivation, using the same method as Python, has the following format:
expressionforinif (condition) ]
Like what:
letforin range(010if20)]
Evensquares is an array that represents the square of even numbers between 0~10.
7. Generator expression
The generator expression. The use method is similar to Python, and the square brackets in the array derivation are replaced with parentheses. Returns an object rather than an array.
8, function shorthand
function shorthand is useful for simple functions, i.e., expression closures. Omit the return keyword and braces, such as the following example:
letfunction(x) x+1;
9. Exception handling for multiple catch statements
In exception handling. Can have multiple catch statements, and the capture condition can be inferred using if. To capture what we need.
10, e4x
E4X, or ECMAScript for XML, is a standard extension of JavaScript that defines a series of powerful features for working with XML documents.
Subsets and hyper-sets of javascript