mardi 5 février 2019

How can you tell if a js class method is static or not?

E.g. in javascript, how can we tell the difference between:

class Foo { 
   bar() {
   }
}

and

class Foo { 
   static bar() {
   }
}

Especially if we allow inheritance, so Foo might extend Fo, which might also define a method with the same name.

Context: I'm writing a reflection utility, that has to work with other people's code, and should list the static vs instance methods of a class.





Aucun commentaire:

Enregistrer un commentaire