What's the correct way to discover what kind of thing an object is. I'm trying to debug a process which makes use of a lot of d3 object. I suspect that one object might not be the kind of thing that we expect it to be. I'd like to be able to log the name of the object. In python I could do:
foo.__class__.__name__
But what's the JavaScript equivalent? Given a mystery object I just want to know what kind of thing it is. In this example, I want to know that foo is actually a d3.map:
coffee> foo = d3.map()
{ _: {} }
coffee> foo.prototype
undefined
coffee> foo
{ _: {} }
coffee>
The method described in "How do I get the name of an object's type in JavaScript?" does not seem to work here because foo's prototype is undefined.