I read it on mdn. The original is:
The
static
keyword defines a static method for a class. Static methods are called without instantiating their class and are also not callable when the class is instantiated.
I thought static
in js is similar to static
in java but the sentence in question confuses me.
It is similar. However, Java allows calling static methods on the instance:
p1.distance(p1, p2);
which does the same thing as
Point.distance(p1, p2);
The first one is not allowed in JavaScript.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments