Since went to Baidu for a long time did not update the blog, read the previous written east, before the small company or relatively idle AH. The irony is this time to change jobs to small companies, just remember to write a blog ...
After going to Baidu to learn Python, and then the front of GG gone, I do not want to use Python, the full effort to switch to Nodejs.
More and more like the JS family, recently looked at the new features of ECMA6, and indeed enhanced the vitality of JS AH. See foreign Asmjs Daniel's video said, JS author only 10 days to create the language.
So hopefully the ECMA will continue to improve.
A little more nonsense. Here's the dry goods. Note that the code will be executed with node--harmony, and the code will run in strict mode.
Let, in fact, is the block-level scope declaration variable var. The var keyword of the previous JS is a non-block-level scope, but a function-level.
For example arr=[0,1,2], we often write loops for (var i=0,len=arr.length; i < Len; i++) {}, in fact, after the loop this I is also accessible to 2. This makes it easy to pollute environment variables.
If Let,for (let i=0,len=arr.length; i<len; i++) {} is used, then the loop i is undefined.
function*, declare the constructor, return {Value:v,done:true_or_false}. The constructor can call next to get the next value, which can be constructed like a random number generator.
Yield and function* are used together. In the constructor function, yield can pause and then return the value of the current expression.
For example function A () {yield 1;yield 2;}; var gen=a (); Console.log (Gen.next ()); Console.log (Gen.next ()); Console.log (Gen.next ()); The result is {value:1,done:false},{ Value:2,done:false},{value:undefined,done:true}. After the first line of yield 1 that constructs a function is executed, the a function exits and saves the context, and when you execute next again the A function context resumes execution of the next line B.
Promise, this non-ECMA6 feature, Html5rocks has a very good article written. Mainly to solve the problem of multi-layer nesting. Converts a nested callback into a chained call.
JavaScript new features Let,function*,yield,promise