I have this object:
var Point = {
step: function () {
alert("hello");
}
};
This works: Point.step();
.
How to make it work with the [ ]
notation? Meaning Point["property_name"]
.
It is Point["step"]();
. Here is the snippet:
var Point = { step: function () { alert("hello"); } }; Point["step"]();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.