Kummy's Blog

o(︶︿︶)o { name : 'Kummy' , job : 'Feser' }

《一些神奇的JS功效》

1: async 异步回调 (ES6)

async function test(){
       console.log("hello wolrd");
 }

 test().then(function(){
     console.log("回调测试")
 }); 

2: 沉睡排序

var numbers=[1,2,3,4,5,5,99,4,20,11,200];
numbers.forEach((num)=>{
    setTimeout(()=>{
        console.log(num)
    },num)
})

3: 快速去重  (ES6)

var arr = Array.from(new Set([1,2,3,4,4,3,5,6,7,8,8]));

 

还在不断收集更新中........

 

posted @ 2017-04-28 17:46  李 维  阅读(480)  评论(0编辑  收藏  举报