I have a value and want to know if it\'s an iteratable object literal, before I iterate it.
How do I do that?
Strangely, I'm seeing different values for toString() for a subclassed object depending how toString() is being called:
Object.prototype.toString.call(aThing)
"[object Object]"
aThing.toString()
"ZmPopupMenu"
That results in a false positive, so I amended it to prefer the object's toString():
var str = someObject.toString
? someObject.toString()
: Object.prototype.toString.call(someObject);
return str === '[object Object]';