Disadvantage
Augment build-in prototypes under all of the conditions below:
If these three conditions are met, you can proceed with the custom addition to the prototype, following this pattern:
if (typeof Object.protoype.myMethod !== "function") { Object.protoype.myMethod = function () { // implementation... }; }
JavaScript Patterns 2.5 (Not) Augmenting Build-in Prototypes,布布扣,bubuko.com
JavaScript Patterns 2.5 (Not) Augmenting Build-in Prototypes
原文:http://www.cnblogs.com/haokaibo/p/Not-Augmenting-Build-in-Prototypes.html