摘要: let,const是es6种新增的关键字; let的特点: let声明的变量只在let所在的代码块有效 let没有变量提升功能,所以作用域只在所声明的代码块中,在该代码外之外都访问不到 let变量只能声明一次,不能重复声明(同一个作用域下) { let a=1; console.log(a);//1 阅读全文
posted @ 2020-01-11 14:05 Dora Doris 阅读(203) 评论(0) 推荐(0) 编辑
摘要: let和var区别: 1 for(var i=0;i<5;i++){ 2 setTimeout(()=>{ 3 console.log(i);//5个5 4 },100) 5 } 6 console.log(i);//5 7 console.log(' ') 8 9 for(let j=0;j<5; 阅读全文
posted @ 2020-01-11 11:57 Dora Doris 阅读(1979) 评论(0) 推荐(1) 编辑