let
- 有严格的作用域
- 变量名称相同只能声明一次
- 不存在变量提升
const
- 声明之后不允许被改变
结构表达式
//数组结构
let arr = [1,2,3];
let [a,b,c] = arr;
//对象解构
const person = {
name:"jack",
age:21,
language:["java","js","css"]
}
const{name:abc,age,language} = person;
//字符串模板
let ss = `
<div>
<a></a>
</div>
`
函数优化
const person = {
name:"jack",
age:21,
language:["java","js","css"]
}
var hello = (obj) => console.log("hello,"+obj.name);
var hello = ({name}) =>console.log("hello,"+name);