For example, the Array data type has a function called pop() , which I suppose is added with:
Array.prototype.pop = function(){ };
But as far as I know, the only way to make it non-enumerable is to do something like this:
Object.defineProperty(Array.prototype, "pop", { enumerable: false });
Which is not supported by all browsers.
Array.prototype.doSomething= function(){ }; var arr = []; console.log(arr);
So why doSomething appears here and pop() doesn't? Are they both added to the prototype?
Johan source share