添加一个方法我有这样的对象:问题与对象
var Point = {
step: function() {
alert("hello");
}
};
这工作:Point.step();
。
如何使它符合[ ]
表示法?含义Point["property_name"]
。
添加一个方法我有这样的对象:问题与对象
var Point = {
step: function() {
alert("hello");
}
};
这工作:Point.step();
。
如何使它符合[ ]
表示法?含义Point["property_name"]
。
它是Point["step"]();
。这里是片段:
var Point = {
step: function() {
alert("hello");
}
};
Point["step"]();
'点[ “步骤”]()'? – 2015-04-01 08:25:52
@ArunPJohny你能否写下你的评论作为答案,以便你可以拿出信用回答这个问题? :) – eAbi 2015-04-01 08:31:16