开发者

Adding methods to a JavaScript object

I have an object that's the argument of a function.

I want to add methods to those objects, so I can easily perform operations on them.

How do I add those methods to the object?

stuff.on('move', function (element) {
    element.remove()
    element.add()
    element.change()
})
开发者_如何学编程


element.remove = function(){
    ...
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜