js static methods

JavaScript
class ClassWithStaticMethod {
  static staticMethod() {
    return 'static method has been called.';
  }
}

console.log(ClassWithStaticMethod.staticMethod());
// expected output: "static method has been called."
// *** JS Class STATIC method ***   

class Animal {
        sayHello() {
            return `${this.constructor.greeting}! I'm ${this.name}!`;
        }
    }

    class Cat extends Animal {
        constructor(name) {
            super(); // connects parent to child/constructor
            this.name = name; //=> need this line otherwise name undefined
        }
        static greeting = 'Feed me';
    }

    class Dog extends Animal {
        constructor(name) {
            super();
            this.name = name; // same output type as above
        }
        static greeting = 'Sigh';
    }

    const run = document.getElementById("run");
    run.addEventListener('click', () => {
        let Garfield = new Cat('Garfield');
        let Snoopy = new Dog('Snoopy');
        console.log(Garfield.sayHello());
        console.log(Snoopy.sayHello());
    })
// output = Feed me! I'm Garfield! Sigh! I'm Snoopy!class Foo(){   static methodName(){      console.log("bar")   }}class Hi {
	constructor() {
      console.log("hi");
    }
   	my_method(){}
  	static my_static_method() {}
}

function getStaticMethods(cl) {
  return Object.getOwnPropertyNames(cl)
}

console.log(getStaticMethods(Hi))
// => [ 'length', 'prototype', 'my_static_method', 'name' ]

Source

Also in JavaScript: