Answer to the 1st question:
Yes, the expression in the MDN manual is not 100% accurate, but in your daily work it would be better to follow it as a rule. You really don't need to create property names that are numbers.
The answer to the second question:
A property name may not start with a digit, but a property name, which is a number without any other characters in its name, is wonderful.
This exception exists because the properties with the number for the name are the same as indexes .
Let's try this:
var obj = {7: "abc"}; obj[7];
Now try calling Array.push on the object and observe what happens:
Array.prototype.push.call(obj, "xyz"); console.log(obj); console.log(obj[0]); // Prints Object {0: "xyz", 7: "abc", length: 1} "xyz"
You can see that several new properties are added to the object (one with the name 0 and the other with the name length ). Alternatively, you can use the object as an array:
var obj = { "0": "abc", "1": "xyz", length: 2 }; Array.prototype.pop.call(obj); // Returns: "xyz" Array.prototype.pop.call(obj); // Returns: "abc"
You can use array methods for objects, and this is called Duck Typing .
Arrays are nothing more than objects with some predefined methods.
From MDN :
Array elements are object properties in the same way that length is a property, but trying to access an array element with dot notation causes a syntax error because the property name is not valid. There is nothing special about JavaScript arrays and the properties that cause this. JavaScript properties that begin with a number cannot be specified using dot notation and must be accessible using notation.
Now you can understand why the number for the property name is valid. They are called simply indexes, and they are used in JavaScript arrays. And since JavaScript must match other languages, numbers are valid for index / property names.
Hope this makes it clear.
Here are some interesting articles: