我的代码属性:JavaScript的 - 不能设置的不确定
var a = "1",
b = "hello",
c = { "100" : "some important data" },
d = {};
d[a]["greeting"] = b;
d[a]["data"] = c;
console.debug (d);
我得到以下错误:
Uncaught TypeError: Cannot set property 'greeting' of undefined.
我试图做类似的关联数组的东西。为什么这不起作用?
d [a]是未定义的。本质上d [“1”]是未定义的 –