簡體   English   中英

在對象中添加方法的問題

[英]issue with adding a method in object

我有這個對象:

var Point = {
    step: function () {
        alert("hello");
    }
};

這有效: Point.step();

如何使其使用[ ]表示法? 含義Point["property_name"]

這是Point["step"](); 這是代碼段:

 var Point = { step: function () { alert("hello"); } }; Point["step"](); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM