ES6学习笔记
1.解构赋值
//数组解构
let [a,b,c] = [1,2,3]
console.log(a) //1;
console.log(b) //2;
console.log(c) //3
//对象解构
let {foo,bar} = {foo:"test",bar:"try"}
console.log(foo) //test
console.log(bar) //try
//字符串解构
let [a,b,c,d] = "test";
console.log(a) // t
cons
原创
2020-05-28 14:49:37 ·
239 阅读 ·
0 评论