Answers for "get methods of class javascript"

0

get methods of class javascript

class Hi {
	constructor() {
      console.log("hi");
    }
   	my_method(){}
  	static my_static_method() {}
}

function getMethods(cl) {
  return Object.getOwnPropertyNames(cl.prototype)
}

console.log(getMethods(Hi)) // => [ 'constructor', 'my_method' ]
Posted by: Guest on October-11-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language