jQuery Data Type How to - Check if a value is an array








Question

We would like to know how to check if a value is an array.

Answer


<!--  ww  w. jav  a 2  s. c  om-->
<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type="text/javascript">
        $(document).ready(function(){
               console.log($.isArray([]) );
        });
    </script>
  </head>
</html>

The code above is rendered as follows: