Are prototypes bad in JavaScript?

前端 未结 2 488
离开以前
离开以前 2021-01-31 11:11

In Felix\'s Node.js Style Guide it says:

Do not extend the prototypes of any objects, especially native ones. There is a special place in hell waiting

2条回答
  •  灰色年华
    2021-01-31 11:48

    Do not extend the prototypes of any objects, especially native ones.

    When you extend native objects, like for example string that could be a problem because users are expecting some behavior from that object, but are getting different results. They could get a hard time debugging this..

提交回复
热议问题