数组 - 混淆的地方

判断是否为数组

1 var is_array = function(value) {
2         return value && typeof value === 'object' && typeof value.length === 'number' && typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));
3     };
4     
5 //使用方法
6 var arrayValue = [];
7 console.log(is_array(arrayValue));

 

posted @ 2012-07-15 16:51  小猩猩君  阅读(173)  评论(0编辑  收藏  举报