1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="http://code.jquery.com/jquery-latest.js"></script> 5 </head> 6 <body> 7 Is [] an Array? <b></b> 8 <script>$("b").append( "" + $.isArray([]) );</script> 9 10 </body> 11 </html>
1 Is [] an Array? true
1 $.isArray(123); // false 2 $.isArray(true); // false 3 $.isArray([1, 2]);// true 4 $.isArray(new Array(3, 4)); // true
$.isArray()
返回一,用来指明对象是否是一个JavaScript数组(而不是类似数组的对象,如一个jQuery对象)。