fex-team / styleguide

文档与源码编写风格
Creative Commons Attribution 4.0 International
2.54k stars 853 forks source link

是否要阻止对基础对象原型的拓展或修改 #16

Open techird opened 10 years ago

techird commented 10 years ago

在 jshint 中有一个选项 freeze,阻止下面的代码:

Array.prototype.max = function() { ... }

是否要加入这条规范?

Singularity-zju commented 10 years ago

最好是允许扩展,不允许修改。。 但是好像ES5的对象方法还做不到这点 。。。 很多库还是依赖于扩展原型吧