Object.prototype.toString is a great way to find the “class” of an object, but it only works for the native constructors like
new Foo are
[object Foo] instead of
[object Object]. I have also made some examples that you can run to see the toStringX library in action that you can find in the toStringX repository README.