async async is a keyword related to asynchronous operations that only exists in ES7, and it is closely associated with Promise and Generator. Syntax async function name([param[, param[, ...
ES6 newly introduced Generator functions, which can suspend the execution flow of a function through the yield keyword, providing the possibility to change the execution flow, thereby offering a solution for asynchronous programming. Basics...
Overview It is a solution for asynchronous programming. In terms of syntax, a Promise is an object from which messages about asynchronous operations can be obtained. Promise States Characteristics of States Promise exceptions...
Overview Before ES6, modularization was implemented using RequireJS or seaJS (which are respectively a modularization library based on the AMD specification and a modularization library based on the CMD specification). ES6 introduced...
Overview In ES6, class was introduced as a template for objects, and classes can be defined using the class keyword. The essence of class is function. It can be regarded as syntactic sugar, allowing objects...
Function parametersofExtensions Default parameter Basic Usage function fn(name,age=17){ console.log(name+","+age); } fn("Amy",18); // Amy...
Array Creation Array.of() Forms an array with all values in the parameters as elements. console.log(Array.of(1, 2, 3, 4)); // [1, 2, 3, 4] // Parameter values can be of different types co...
Object Literals Concise representation of properties ES6 allows object properties to be written directly as variables; in this case, the property name is the variable name, and the property value is the variable value. const age = 12; const name...
Number Representation New binary notation syntax: prefix 0b or 0B. console.log(0b11 === 3); // true console.log(0B11 === 3); // true New octal notation s...
Extended Methods Substring detection Before ES6, the indexOf method was used to determine whether a string contains a substring; ES6 added new substring detection methods. includes(): returns a boolean value, determining whether...