I created a JavaScript object, but how I can determine the class of that object?
I want something similar to Java\'s .getClass() method.
.getClass()
You can also do something like this
class Hello { constructor(){ } } function isClass (func) { return typeof func === 'function' && /^class\s/.test(Function.prototype.toString.call(func)) } console.log(isClass(Hello))
This will tell you if the input is class or not