Revision: 48506
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 3, 2011 16:07 by anagaiyahoocom
Initial Code
if(typeof Array.isArray==="undefined") { Array.isArray = function(arg) { return Object.prototype.toString.call(arg)=== "[object Array]"; }; }
Initial URL
Initial Description
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
Initial Title
Check if javascript object is an Array
Initial Tags
javascript
Initial Language
JavaScript