/ Published in: JavaScript
                    
                                        
This will check if object is an array object.
This will add isArray() method to Array native object. Can be used to check if passed in object is an array. Future ecmascript 5 will have this included. Can use this in the meantime.
Using instanceof Array does not work in certain versions of IE.
e.g.
var arr = [1,2,3];
alert(Array.isArray(arr)); //displays as true
                This will add isArray() method to Array native object. Can be used to check if passed in object is an array. Future ecmascript 5 will have this included. Can use this in the meantime.
Using instanceof Array does not work in certain versions of IE.
e.g.
var arr = [1,2,3];
alert(Array.isArray(arr)); //displays as true
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
if(typeof Array.isArray==="undefined") {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg)=== "[object Array]";
};
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                