const arr = ["a", ["b", "c", ["d"],
[undefined, "g", ["x"],
["y"]
]
], "h", ["1"]];
[a, [b, c, d, f = [t, g, p, r]], i, k] = arr;
f.splice(0, 1, 'wys');
f[2].splice(0, 1, 'xx');
console.log(arr);
/**
* Array(4)
0: "a"
1: Array(4)
0: "b"
1: "c"
2: ["d"]
3: Array(4)
**0: "wys"**改变
1: "g"
**2: ["xx"]**改变
3: ["y"]
length: 4
*/
//作业2
let node = {
type: "Identifier",
name: "ES",
loc: {
start: ["line", "column"],
end: {
line: 1,
column: 4
}
}
};
let {
type,
name,
loc: {
start: [a, b],
end:{
line,
column,
},
}
} = node;
console.log(a);//line
console.log(column);//4
什么是javascript? JavaScript和ECMAscript的关系?
变量的声明let声明:
不存在变量提升,
块级作用域
不存在变量提升
暂时性死区。
const声明:常量。
函数的扩展:
具名函数(有名字的函数)
箭头函数
默认函数
赋值的扩展:
运算符:算数运算符,赋值运算符,关系运算符,逻辑运算符,位运算符,条件运算符,
数据类型:
斜体样式值类型(基本数据类型):6种字符串(String)、数字(Number)、布尔(Boolean)、对空(Null)、未定义(Undefined)、Symbol。
引用数据类型:对象、数组、函数
解构赋值:
数组的结构:let [a,…b] = [1,2,3]
对象模型的解构:let obj={str='hello woril',arr=[1,2]}; let {str,arr:[a,b]