摘要: 第一种最常用的:for循环 for(j = 0; j < arr.length; j++) { } 优化版for循环 for(j = 0,len=arr.length; j < len; j++) { } 对于数组较大时,优化比较明显; 第二种:foreach arr.forEach(functio 阅读全文
posted @ 2020-06-11 08:58 永远想睡觉 阅读(119) 评论(0) 推荐(0)
摘要: 箭头函数: let fun = () => { console.log('lalalala'); } 普通函数: function fun() { console.log('lalla'); } 箭头函数相当于匿名函数,并且简化了函数定义。箭头函数有两种格式,一种只包含一个表达式,连{ ... }和 阅读全文
posted @ 2020-06-11 08:48 永远想睡觉 阅读(205) 评论(0) 推荐(0)