ES6 - Call static method within a class

后端 未结 3 607
夕颜
夕颜 2020-11-27 04:21

I have this class which does an internal call to a static method:

export class GeneralHelper extends BaseHelper{
     static is(env){
          return config         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 04:33

    if you are calling the static function from inside an instance, the right way to refer to the class static function is:

    this.constructor.functionName();

    es6 call static methods

提交回复
热议问题