As the questions says, is it possible to replace such functions with an own implementation?
Like:
Array.prototype.forEach = function () {
console.log("foo");
};
That's - of course - a stupid replacement. But this is more about the possibility. I tried it, but then it seemed like at runtime it's not replaced.
My console logs the foo
. But when I'm calling something like
[].forEach();
which also shout log foo
, it does not work, until I replace the forEach function again in the console.