lzcdev / Daily-Front-End-Questions

每日前端面试题、技巧等知识点,记录自己的成长过程
MIT License
1 stars 0 forks source link

输出什么?(字符串解构) #15

Open lzcdev opened 5 years ago

lzcdev commented 5 years ago

1.

let { length } = 'hello'
console.log(length);

2.

let { length: len } = 'hello'
console.log(len);
console.log(length);

3.

let { len } = 'hello'
console.log(len);
lzcdev commented 5 years ago
  1. 5
  2. 5 ReferenceError: length is not defined
  3. undefined