Is there a way to copy a global object (Array, String ...) and then extend the copy prototype without affecting the original? I tried with this:
var copy=Array;
copy.prototype.test=2;
But if I check Array.prototype.testfor 2, because the Array object is passed by reference. I want to know if there is a way to make the "copy" variable behave like an array, but can be expanded without affecting the original Array object.
source
share