Last active
December 27, 2020 07:32
-
-
Save stefango/b68d4e0b42d1f77fd63dc33ddf459fbc to your computer and use it in GitHub Desktop.
js 解构赋值
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [5,6,7] | |
let [a] = arr // a: 5 | |
let obj = {'age': 21, 'name': 'xzl'} | |
let {name, age} = obj // name: "xzl",age: 89 | |
// 数组解构按顺序赋值,对象解构按key赋值 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment