Revisiting extending native prototypes after ECMAScript 5

前端 未结 2 1086
温柔的废话
温柔的废话 2020-12-11 20:06

Recently, given the changes to defining properties in ECMAScript 5, I have revisited the question of whether we can safely extend the native JavaScript prototypes. In truth

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 20:20

    The definitive, absolute answer is ...

    "It depends." :)

    Extending any built in JavaScript object can be perfectly safe or it can be a complete disaster. It depends on what you are doing and how you are doing it.

    Use smart practices and common sense and test the hell-out-of-it.

提交回复
热议问题