Optional chainOperator (? .)

– “Is this air-raid symbol usable in JS?”

“–” ES6 syntax!”

From the “Little Red Book 3, 4” into my line, since I think that the foundation passable, so said, but appears a face meng B, so still have a good look at ES5/ES6

ES5/ES6

  • JavaScript Advanced Programming (Version 4)
  • JavaScript Tutorial · Ruan Yifeng
  • ES6 Tutorial · Ruan Yifeng
  • Ecma-262 5.1 Edition
  • Ecma-262 6 Edition
  • Ecma-262 5.1 Edition translated by Yan Haijing
  • Browser ES6 supportkangax.github.io

It seems that “Little Red Book 4” does not strictly distinguish ES5 and 6, so to distinguish 5 and 6, we still need to read the two books of ruan Yifeng. (You can also look at the ES5 and 6 specifications, but after looking at some, it seems that they are not intended for JSer.)

Little Red Book 4 vs JavaScript Tutorial by Yifeng Ruan

  • Red 4 calls null and undefined primitive types and Ruan calls them special values

  • Ruan writes Base64 transcoding in the string section, but transcoding methods btoa() and ATob () are the host methods of window (this is mentioned in Red 4 and MDN’s WorkerGlobalScope).

  • Ruan mentions that function has the length attribute (refers to the number of parameters to be defined), while Red 4 does not. It only mentions that arguments.length is used as the parameter format

  • Ruan mentions the use of void as a function in the other operators section, while Red 4 does not

  • Ruan has more on console in the Console section, such as console.table() and console.dir

  • Red 4 has a strict Mode section in the catalog

Air defense operator

At the end of the ES6 nguyen Object Extension section:

  • Chain judgment operator ? .alternativeobj.property && obj.property.value
  • The Null judgment operator ??alternativeisFalsyValue || defaultValue