![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
es6
js_Allen
这个作者很懒,什么都没留下…
展开
-
let和const
使用let和const取代var。letlet声明的变量只在let命令所在的代码块中有效 优点: 1.不存在变量提升 2.暂时性死区:只要块级作用域内存在let命令,它所声明的变量就“绑定”这个区域,不再受外部的影响。 var tmp = 123; if (true) { tmp = 'abc'; // ReferenceE原创 2016-06-25 11:14:04 · 524 阅读 · 0 评论 -
javascript遍历数组的方法以及for…of
1、最原始的for(let i=0; i<myArray.length; i++){ console.log(myArray[i]); }2、forEachmyArray.forEach(function(value){ console.log(value); })但它无法中途跳出forEach循环,break命令或return命令都不能奏效。3、for…infor…in主要是为遍历原创 2016-06-26 09:49:03 · 7487 阅读 · 0 评论