Arrow function, extended operator

- the function parameter may also set default values, when arguments parameter is not passed down the default value

function fn(x=1, y) {
        console.log(x,y);//1,undefined

}
fn();

- Extended operator ...

  - can be turned into an array of non-array, or array can be turned into an array

[... argument] // array will become an array of classes
... [2]; // array [2] into a digital 1,2
[... ary1, ... ary2]; // array of splicing 
a digital string becomes the fastest way "" +1
  
Function arrow 
  arrow without this function, the function of the arrow to its parent in the scope of this lookup function ABS (A) { 
    the console.log (A) 
} 
// rewritten as a function of an arrow: = function name (parameter) => {} 
= ABS (A) => { 
    the console.log (A) 
}; 
ABS (10)
    


  

Guess you like

Origin www.cnblogs.com/zlsqd/p/11334264.html