码迷,mamicode.com
首页 > Web开发 > 详细

《一些神奇的JS功效》

时间:2017-04-28 20:31:23      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:time   收集   size   cti   func   set   异步回调   new   test   

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]));

 

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

 

《一些神奇的JS功效》

标签:time   收集   size   cti   func   set   异步回调   new   test   

原文地址:http://www.cnblogs.com/Kummy/p/6782682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!