Live2D

ES7

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

 

posted @ 2019-04-01 17:59  Candice&Gladys  阅读(101)  评论(0编辑  收藏  举报