1

I have an ES6 class with a static method. From another class, I wish to call that static method, but in some instances, the method may not exist.

how do I check if a static method exists before calling it?

class MyClassOne
{
    static myStaticMethod()
    {
        .... do something
    }
}

Thanks

class MyClassTwo
{
    myFunc()
    {
        if(MyClassOne.myStaticMethod)  <-- what should this be?
            MyClassOne.myStaticMethod;
    }
}
Typhoon101
  • 1,647
  • 7
  • 24
  • 43

0 Answers0