Check if object is array. The method given in the ECMAScript standard to find the class of Object is to use the toString method from Object.prototype. From http://stackoverflow.com/questions/4775722/check-if-object-is-array
if( Object.prototype.toString.call( someVar ) === '[object Array]' ) {
alert( 'Array!' );
}