javascript add prototype method to all functions?

前端 未结 4 877
星月不相逢
星月不相逢 2021-02-05 09:54

Is there a way to add a method to all javascript functions without using the prototype library?

something along the lines of :

Function.prototype.methodN         


        
4条回答
  •  余生分开走
    2021-02-05 10:26

    Changing JS built-in objects can give you some surprises.
    If you add external libraries or changing the version of one of them, you are never sure that they won't overwrite your extension.

提交回复
热议问题