let变量声明及特性

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
// 变量声明
let a;
let b,c,d;
let e = 100;
let f = 521, g = 'hello', h = [];
// 1.变量不能重复使用
// let str = '小网';
// let str = '小王';

// 2.块级作用域 全局 函数 eval
// if else while for
// {
// let sm = '123'
// }
// console.log(sm);

// 3.不存在变量提升
// console.log(num);
// let num = 1213;

// 4.不影响作用域链
{
let sh = '学校';
function fn(){
console.log(sh);
}
fn();
}
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/weixin2623670713/p/13428136.html