Adding custom properties to a function

后端 未结 10 776
独厮守ぢ
独厮守ぢ 2020-11-27 10:34

Searching for appropriate answer proved difficult because of the existence of many other problems related to my keywords, so I\'ll ask this here.

As we know, functio

10条回答
  •  粉色の甜心
    2020-11-27 11:14

    If you just want to add custom properties to a function then you only need to add those properties to Function.prototype. For example:

    Function.prototype.SomeNewProperty = function () {//Do something awesome here...}
    

提交回复
热议问题