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()
})
Peter Mortensen
31.3k22 gold badges110 silver badges134 bronze badges
asked Mar 30, 2011 at 12:01
Harry
55.4k76 gold badges187 silver badges276 bronze badges
1 Answer 1
element.remove = function(){
...
};
answered Mar 30, 2011 at 12:04
Fender
3,0551 gold badge19 silver badges25 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
btleffler
For some reason, I remember reading that older versions of IE wouldn't let you do stuff like this. Am I making that up? Also, would there be a problem with using
element.prototype.remove, or is that where older browsers draw the line.lang-js