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(){
...
};
精彩评论