1

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()
})

1 Answer 1

3
element.remove = function(){
    ...
};
Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.