Javascript
CA
Extending JavaScript Natives
[]
JavaScript, JavaScript
The for in loopA secondary grumble, commonly heard but harder to justify, is that extending natives messes with the object iteration cycle.
ShadowingWhen it comes to extending Object.prototype (as opposed to native objects in general) there’s another reason to be wary.
Extending Object.prototype “is Verboten”¹For some or all of these reasons, the JavaScript community has considered Object.prototype extensions taboo for several years, and you’re very unlikely to see such extensions in production code or respected frameworks.
Should you decide its okay to augment a native prototype, another problem arises: other library providers might reach the same conclusion.
Native extensions are neither right or wrong; as with so much in the JavaScript realm, there’s more grey than black-and-white.
['natives'
'objects'
'standard'
'var'
'native'
'extensions'
'javascript'
'prototype'
'extending'
'es'
'prototypejs'
'browsers'
'objectprototype']