Array.isArray()

1 var isArray = function(arr){
2         return typeof Array.isArray === "function" ? Array.isArray(arr) : Object.prototype.toString.call(arr) === "[object Array]";
3     };
4     var arr = [1, 2, 3, 4];
5     console.log(isArray(arr));

 

posted @ 2013-10-09 14:12  楚玉  阅读(340)  评论(0编辑  收藏  举报