ES5中
var a = 12;
function f(){};
console.log(window.a); // 12
console.log(window.f); // f(){}
ES6中
let aa = 1;
const bb = 2;
console.log(window.aa); // undefined
console.log(window.bb); // undefined
在块级作用域script中.png
ES5中
var a = 12;
function f(){};
console.log(window.a); // 12
console.log(window.f); // f(){}
ES6中
let aa = 1;
const bb = 2;
console.log(window.aa); // undefined
console.log(window.bb); // undefined
在块级作用域script中.png
本文标题:27,const和let的理解
本文链接:https://www.haomeiwen.com/subject/tmcqwctx.html
网友评论