Checking either the objects is Array or Objects is a very common job in nowadays. For the most common way is using `instanceof`
myArr instanceof Array // if myArr is array return true
It works perfect in most way, EXCEPT when you are using it inside iFrame. Multiple frame in single page will cause instanceof to detect Array as Object. It is absolutely pain…
Yet, you can still checking Array inside iFrame without using instanceof by Object.prototype.toString.call method. It will returned ‘[object Array]’ if myArr is Array.
Object.prototype.toString.call(myArr) === '[object Array]'
If you want to know more about the bugs, check it out kangax blogs. This site is more informative on it.