How do you remove a method from a javascript type-Collection of common programming errors

I have a bit of javascript that runs on a 3rd party’s website which requires me to temporarily add a function to the Array type, e.g.

Array.prototype.foo = function() { alert("foo's for everyone!"); }; 

I want to be a good developer and not pollute the type systems of other people’s code as much as possible so once the function is no longer needed I want to remove the function again. Is this possible?

Originally posted 2013-11-10 00:45:35.