Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get static methods of class javascript

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 by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #static #methods #class #javascript
ADD COMMENT
Topic
Name
4+9 =