You can look up the object’s constructor, then reference its name property. This method returns a string that represents the class name of the object. You can also directly compare the constructor property to the class, like this: hypertrophicclass Dog { } const roger = new Dog () roger . constructor === Dog //true

1m read timeFrom flaviocopes.com
Post cover image

Sort: