In javascript how can we identify whether an object is a Hash or an Array?

Modern browsers support the Array.isArray(obj) method.

See MDN for documentation and a polyfill.

= original answer from 2008 =

you can use the constuctor property of your output:

if(output.constructor == Array){
}
else if(output.constructor == Object){
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)