标签:
1、箭头函数var aFunction = x=>x*x;aFunction(a);
2、块级作用域{let}
3、``(替代+号进行字符串拼接),var name = "qiaoge";`i am ${name}`
4、let [name, age, school, income] = ["jack", 22, "Wugao", 48093];let括号中的当作变量使用。
5、函数支持默认参数function addTwoNumbers(x=0, y=0) {return x + y;},参数从右到左可以省略。
6、展开操作Math.max(...[1,1244,32,653]);//1244
let cities = [‘San Francisco‘, ‘Los Angeles‘];
let places = [‘Miami‘, ...cities, ‘Chicago‘]; // [‘Miami‘, ‘San Francisco‘, ‘Los Angeles‘, ‘Chicago‘]
7、reduce(function(previousValue,currentValue,index,arr){},initialValue);设置第二个参数,则index=0,不设置,index=1;
8、var x = new Promise(function(resolve,reject){//成功返回使用resolve();里面可以带信息,失败返回使用reject()}).then(function(data){console.log(data)});
标签:
原文地址:http://www.cnblogs.com/buptqiaoge/p/5939712.html