<!DOCTYPE html>
<html>
<body>
<p>
If you use a named index, when accessing an array, JavaScript will redefined the array to a standard object, and all array methods and properties will produce undefined or incorrect results.
</p>
<p id="demo"></p>
<script>
var person = [];
person["firstName"] = "John";
person["lastName"] = "Doe";
person["age"] = 46;
document.getElementById("demo").innerHTML =
person[0] + " " + person.length;
</script>
</body>
</html>