Why does typeof array with objects return “object” and not “array”? [duplicate]

Possible Duplicate:
JavaScript: Check if object is array?

Why is an array of objects considered an object, and not an array? For example:

$.ajax({
    url: 'http://api.twitter.com/1/statuses/user_timeline.json',
    data: { screen_name: 'mick__romney'},
    dataType: 'jsonp',
    success: function(data) {
        console.dir(data); //Array[20]
        alert(typeof data); //Object
    }
});​

Fiddle

3 Answers
3

Leave a Comment