📜  将元素值分配为对象数组中的键 - Javascript 代码示例
📅  最后修改于: 2022-03-11 15:04:15.609000             🧑  作者: Mango
代码示例1
var keys = ['HP', 'QP', 'PS'],
object = Object.assign(...keys.map(key => ({ [key]: 0 })));
console.log(object);