The difference between customize function and native function in prototype
The for...in
statement...
iterates over all non-Symbol, enumerable properties of an object. (source: MDN)
However, if you look at the ECMA specification, in the item "Properties of the Array Prototype Object", you'll see that:
The Array prototype object is the intrinsic object %ArrayPrototype%. The Array prototype object is an Array exotic objects and has the internal methods specified for such objects. It has a length property whose initial value is 0 and whose attributes are { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }.
That applies to concat
, filter
, map
, forEach
, sort
, toString
etc...
You can use Object.getOwnPropertyDescriptor
to check those attributes. For instance:
console.log(Object.getOwnPropertyDescriptor(Array.prototype, "concat"));
Finally, for setting those methods with {enumerable: false}
, have a look at the other answer.