📜  javascript ES6 解构动态属性名称 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:17.960000             🧑  作者: Mango

代码示例1
let object = {x: 3, y: 6}
let propertyName = 'x'

// the value of the destructured property is assigned to a new variable
let {[propertyName]: value} = object

console.log(value) // 3