(4)ES6解构赋值-字符串篇
字符串的解构赋值
let [a,b,c,d,e] = 'Apple'; console.log(a); //A console.log(b); //p console.log(c); //p console.log(d); //l console.log(e); //e const { length:len } = 'Hello'; //这边不能用[]因为{}才有属性 console.log(len); //5 const { length } = "Hello World!"; console.log(length); //12