ES6功能

1、``反引号
eg:let a = "world";
   `hello ${a} !` 输出为 hello world !
2、=>箭头函数
eg: (x,y) => x+y;
    (x,y) => {return x+y;}
3、数组新功能

1)定义

eg: let [a, b, c] = [1, 2, 3]
    console.log(a,b,c)//输出值为1,2,3

2)...

let arr = [2,3,4]
let arr2 = [1, ...arr, 5]
console.log(arr2)//输出值为1,2,3,4,5

3)includes

let a = [1,2,3];
console.log( a.includes(2)) //输出值为true

4)map

let a = [1, 3, 5];
let b = a.map((i) => i+1);
console.log(b) //输出值为2,4,6

你可能感兴趣的:(ES6功能)