Duck Typying
Actually, you don't necessarily want to check that an object is an array. You should duck type it and the only thing you want that object to implement is the length
property. After this you can transform it into an array:
var arrayLike = {
length : 3,
0: "foo"
};
// transform object to array
var array = Array.prototype.slice.call(arrayLike);
JSON.stringify(array); // ["foo", null, null]
Array.prototype.slice.call(object)
will transform into an array every object that exposes a length
property. In the case of strings for example:
var array = Array.prototype.slice.call("123");
JSON.stringify(array); // ["1", "2", "3"]
Well, this technique it's not quite working on IE6 (I don't know about later versions), but it's easy to create a small utility function to transform objects in arrays.