jquery-isArray()判断是否为数组
jQuery.isArray( obj ) 用来测试对象是否为一个数组。 [code="jQuery"] var arr = ["1","2"]; alert($.isArray(arr));//true[/code] [code="html"]
测试我是否是数组:
[/code] [code="jQuery"] var arr = ["1","2"]; var str = $.isArray(arr); $("p").text($("p").text().concat(str));[/code] 输出结果---[color=blue][b]测试我是否是数组:true[/b][/color] [url]http://zhangyaochun.iteye.com/blog/1202853[/url] [code="js"] function isArray(source) { return Object.prototype.toString.call(source) === "[object Array]"; } alert(isArray([1, 2]));//true alert(isArray({name: 'wjy'}));//false //Object.prototype.toString.call({name: 'wjy'});返回值:[object Object] [/code]