首页 > 其他 > 详细

ES7

时间:2019-04-01 18:29:25      阅读:130      评论:0      收藏:0      [点我收藏+]

Array.prototype.includes

let arr = [‘react‘, ‘angular‘, ‘vue‘] // Correct

if (arr.includes(‘react‘)) { console.log(‘Can use React‘) }

=============================================

Exponentiation Operator(求幂运算)

let a = 7;

a **= 12;

let b = 2;

b **= 7;

console.log(a=== Math.pow(7,12)); console.log(b=== Math.pow(2,7));

=======================================================

异步操作

async function start (){
let time = Date.now();
console.log(‘time=‘+time);
await delay(100);
console.log(‘t=‘+ (Date.now() - time));
}

function delay(time){
return new Promise((resolve,reject)=>{
console.log(‘===‘);
setTimeout(()=>{
resolve();
},time);
});
}


start();
// time=1554112378551
// ===
// t=102

 

ES7

原文:https://www.cnblogs.com/moneyss/p/10637921.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!