《一些神奇的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]));

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

转载于:https://www.cnblogs.com/Kummy/p/6782682.html

猜你喜欢

转载自blog.csdn.net/weixin_33874713/article/details/93230328