1,
var obj = {}; //或者 var obj=new Object(); var key = "name"; var value = "张三丰" obj[key] = value;
2,
var obj = {}; var key = "name"; var value = "张三丰" eval("obj.p" + key + "='" + value + "'");
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/17435.html