var jsondata = {};
var key1 = "a";
var key2 = "b";
var key3 = "c";
var value1 = "1";
var value2 = "2";
var value3 = "3";
jsondata[key1] = value1;
jsondata.key2 = value2;
jsondata[key3] = value3;
console.log(jsondata);
结果如下:
Object{ a="1",key2="2",c="3"}
javascript中json数据添加元素
最新推荐文章于 2019-03-02 23:34:25 发布