ES6 (new features for functions)

ES6 (new features for functions)

1. Function parameter default value

When there is no y, the default is world

When there is y, the output value can be

(mistake)

(C has default values, correct)

A default value cannot be followed by a variable without a default value

 2. Scope

y takes the x in front of it; instead of x = test;

 

 

x is not in front of y

 3. test parameters

Convert input parameters (discrete values) into arrays

 4. Spread operator

 Convert an array to discrete values

 

5. Arrow functions

arrow is the function name, the first = is the parameter, the => is the return value,

 

 The first parameter can be empty.

 6. Tail calls

(Condition: Is the last sentence of the function a function; used to improve performance, it is recommended to use it in the case of continuous nesting)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325012426&siteId=291194637