title: How to detect if a variable is an array
body: <p>What is the best de-facto standard cross-browser method to determine if a variable in JavaScript is an array or not?</p>
  
  <p>Searching the web there are a number of different suggestions, some good and quite a few invalid.</p>
  
  <p>For example, the following is a basic approach:</p>
  
  <pre><code>function isArray(obj) {
      return (obj &amp;&amp; obj.length);
  }
  </code></pre>
  
  <p>However, note what happens if the array is empty, or obj actually is not an array but implements a length property, etc. </p>
  
  <p>So which implementation is the best in terms of actually working, being cross-browser and still perform efficiently?</p>