You can learn about that in this article

  • The relationship between JavaScript and ECMAScript
  • Let, const, and block-level scopes
  • deconstruction
  • String extension
  • Numerical extension
  • Extension of a function
  • Extension of Arrays
  • Extension of objects
  • Proxy
  • Reflect
  • Promise
  • Class class
  • The Set of the Map
  • Symbol
  • for… of..
  • The Iterable interface
  • Generator

The relationship between JavaScript and ECMAScript

ES is also a scripting language, and is often seen as a standard specification for JavaScript, which is actually an extension of ECMAScript. ECMAScript is a specification for JavaScript. The latter is an implementation of the former (other ECMAScript dialects include JScript and ActionScript)

JS In the browser environment, JS = WEB + ES

JS = Node + ES

Version of the iteration

  • Solve some problems and shortcomings of the original grammar
  • Enhance the existing syntax
  • Brand new objects, methods, and functions
  • New data types, new data structures

Let and block-level scopes

The article entrance

deconstruction

The article entrance

String extension

ES2015 adds an Iterator to strings. So strings can be for… of.. Iterate through the template string

  • Traditional strings do not support newlines \n

    const str = `hello es2015 this is made in China` console.log(str); // empty line will be output const name = "Tom" const MSG = 'hello ${name}' // interpolation console.log(MSG);
  • The label template

    // You can add a tag to the template string, which is a method ["hello world"] const Tag = console.log 'hello world'
    Const n = "McGee" const bol = true function myTagFNC (arr,n,bol){ console.log(arr,n,bol); / / / 'hey,', 'is a', '. '] static content segmentation / / label, to processing const value sex = '?" man":"woman" // return 123 return arr[0]+n+arr[1]+sex+arr[2] } const result = myTagFnc`hey,${n} is a ${bol}.` console.log(result); //123 || hey,mcgee is a true || hey,mcgee is a man
  • The role of the label

The interpolation is processed. The multilingual translation of the text into Chinese and English. Checks for unsafe characters in the template string

String new common method

  • Includes () indicates whether the parameter string is found
  • StartsWith () indicates whether the parameter string is at the head of the original string
  • EndsWith () indicates whether the parameter string is at the end of the original string
  • Repeat () returns a new string, indicating that the original string is repeated n times
  • PadStart (STR. Length,” value to complete “),padEnd() string completion length (ES2017)
const msg = 'Mcgee is a man'
console.log(msg.startsWith("Mcgee")) //true
console.log(msg.endsWith("n")); //true
console.log(msg.includes("is")); //true
'na'.repeat(0) // "" 'na'.repeat(2.9) // "nana" 'na'.repeat(Infinity) // rangeError 'na'.repeat(-1) // rangeError // If the repeat's argument is a string, it is first converted to a number. 'na'.repeat('na') // "" 'na'.repeat('3') // "nanana"

Numerical extension

  • Number.parseInt()
  • Number.parseFloat()
  • Number.isInteger() is used to determine if a numeric value is an integer
  • 2 ** 3 //8 (ES2016)
  • Bigint data type (representing an integer)
Number.isInteger(25) // true Number.isInteger(25.0) // true Number.isInteger(25.1) // false Number.isInteger() // false Number.isInteger() // false Number.isInteger( Number.isInteger(null) // false Number.isInteger('15') // false Number.isInteger(true) // false

Extension of a function

The article entrance

Extension of Arrays

The article entrance

Extension of objects

The article entrance

Proxy,Reflect

The article entrance

Class Class

The article entrance

Set,Map data structure

The article entrance

Symbol type

The article entrance

Iterator,Generator

The article entrance