let the const

let: 1. let variable declared variables do not upgrade, can only be declared after use,
2. the let declaration of a global variable is no longer a window in the property
3. let you declare a variable, it will automatically generate block-level scope, in variable declaration of block-level scope, is only valid in the current scope

	  for(let i = 1;i < 5;console.log(i),i ++){
	  	let i = 10;
	  	alert(i);
	  }
	  console.log(i);
	  for循环本身是一个块级作用域,在这个作用域,它的循环体又是它的子级块作用域.
	  4. 在同一个作用域中,不能重复声明一个变量.
const : 用于声明常量(不能重复声明,不可以重复赋值)
	1. 基本数据类型: 值不允许改变,
	2. 复合数据类型: 引用地址不能改变,堆中的数据可以修改,

Guess you like

Origin blog.csdn.net/weixin_45052104/article/details/90926199