This should do it for you:
if( Object.prototype.toString.call( someObject ) === '[object Object]' ) {
// do your iteration
}
From ECMAScript 5 Section 8.6.2 if you're interested:
The value of the [[Class]] internal property is defined by this specification for every kind of built-in object. The value of the [[Class]] internal property of a host object may be any String value except one of "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String". The value of a [[Class]] internal property is used internally to distinguish different kinds of objects. Note that this specification does not provide any means for a program to access that value except through Object.prototype.toString (see 15.2.4.2).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…