title: Why does the isArray() Javascript method in this example returns true, if the array has been redefined as a standard object?
body: <p><strong>I'm trying to learn Javascript</strong> - here's my issue:</p>
  
  <p>In the <a href="https://www.w3schools.com/default.asp" rel="nofollow noreferrer">w3schools.com</a> javascript array examples, they show the sequent example:</p>
  
  <pre><code>    var person = [];
      person["firstName"] = "John";
      person["lastName"] = "Doe";
      person["age"] = 46; 
      document.getElementById("demo").innerHTML =
      person[0] + " " + person.length;
  </code></pre>
  
  <p>An array "person" has been defined, but then they proceed to add some elements whit a "named" index. Then tries to print the HTML document the 0th element and the number of elements of the array, like you would do with a standard array.</p>
  
  <p>The description says: </p>
  
  <blockquote>
    <p>If you use a named index when accessing an array, JavaScript will
    redefine the array to a standard object, and some array methods and
    properties will produce undefined or incorrect results.</p>
  </blockquote>
  
  <p>In fact, person[0] and person.length return respectively "undefined" and "0". Even is person was initially defined as an array, by inserting new named indexes elements, the array should be redefined as an object. But when i try do use the Array.isArray() method for checking it, it returns true:</p>
  
  <pre><code>var person = [];
  person["firstName"] = "John";
  person["lastName"] = "Doe";
  person["age"] = 46; 
  document.getElementById("demo").innerHTML =
  person[0] + " " + person.length;
  
  document.getElementById('test').innerHTML = Array.isArray(person);// returns true
  </code></pre>
  
  <p>So, why? if, as specified by the tutorial, this has been effectively redefined as a standard object, and the ECMAScript 5 has added the .isArray() method for checking if something is an array and nothing else, shouldn't this return false insted of true?</p>
  
  <p>I'm sure i missed something. If i define person like this:</p>
  
  <pre><code>person = {};
  </code></pre>
  
  <p>then it returns false, as expected. What is happening here? I just wanted to understand arrays a little bit more, this confuses me. Is this just a broken array, but still an array?</p>
  
  <p>Here's the example (without the Array.isarray() bit, just the default): <a href="https://www.w3schools.com/js/tryit.asp?filename=tryjs_array_associative_2" rel="nofollow noreferrer">https://www.w3schools.com/js/tryit.asp?filename=tryjs_array_associative_2</a></p>