ES: Learning Summary 2

1, numerical expansion

1, from after ES6, using the prefix 0b represents a binary number, use 0o representatives octal, decimal conversion with Number () function, in a non-strict mode, 0o011 === 011 returns true, in strict mode error.

2, the new Number method:

image

3, the new method Math:

image

4, left and right shift operator << operator >>

<< left shift operator: In case of a digital does not overflow, the left n bits corresponding to n-th power of 2 multiplied by (of course, first be converted to binary)

Right-shift operator >>: left and opposite, high vacancy complement sign bit is 0 complement, a complement negative

Unsigned right shift operator >>>: regardless of whether positive or negative

The exponential operator (**): e.g. 5 2 ** corresponds to 5 th power of 2

2, string expansion

1, Unicode notation: curly braces represents the Unicode character (\ u {0xXX} or \ u {0XXX})

image

2, the string traversal: for-of traversal through the string

3, String template: a single line can be multiple rows can be inserted into an enhanced version of the string variable is ``

4, label templates: Special call function parameters (that is, $ {variable})

image

5, the new method:

image

3, object extension

1, concise writing object properties

Property name shorthand

imageimageimage

Shorthand method name:

image

2, property name expression

. 3, name attribute method

4, can be traversed and properties enumerated

5, Super Keywords : prototype object points to the current object (can only be used as a shorthand method object method() {})

6, the new method

image

Guess you like

Origin www.cnblogs.com/hxw1024/p/12094105.html