JS中给一个对象动态追加key

var data = https://www.it610.com/article/{}; data['key1'] = "哈哈哈"; var variable = 'key2'; data[variable] = "嘿嘿嘿"; data.key3 = "也行"; console.log(data); //{key1: "哈哈哈",key2: "嘿嘿嘿",key3: "也行"}

【JS中给一个对象动态追加key】

    推荐阅读