自定义对象实例的动态成员名称
·
Yin灏
var id = 'CN24';
var one_item = {[id + '_name']: 'video set', [id + '_price']: 300};
console.log(one_item); // {CN24_name: "video set", CN24_price: 300}
var id = 'CN24';
var one_item = {[id + '_name']: 'video set', [id + '_price']: 300};
console.log(one_item); // {CN24_name: "video set", CN24_price: 300}