'Access numeric properties of an object using dot notation

Why can’t we access this array-like object’s properties with dot notation instead of bracket notation?

function testArray(rat){
  return typeof arguments;
}

console.log(testArray("test")); // "object"

function testArray(rat){
  return arguments.0; // `arguments[0]` works.
}

console.log(testArray("test")); // Throws error.


Solution 1:[1]

You can:

var arr = [];
arr.foo = 'foo';

console.log(arr.foo); // => 'foo'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yckart