Updated Question

What, exactly, qualifies as a valid property name in Javascript? How do various methods of property assignment differ? And how does the property name affect property access?

Note

The answers to my original question (seen below) helped to clear some things up, but also opened a new can of worms. Now that I've had a chance to become a bit more familiar with JavaScript, I believe I've been able to figure a lot of it out.

Since I had a hard time finding this information consolidated into one explanation, I thought it might be helpful to expand my original question, and attempt to answer it.

Original Question

Originally, there was some confusion with the MDN JavaScript guide (object literals). Specifically, I wondered why they claimed that if a property name was not a valid JavaScript identifier, then it would have to be enclosed in quotes. Yet, they offered example code that showed that the number 7 could be used — without quotes — as a property name.

As it turns out, the guide simply left off one important part, and Pointy updated it (changes in bold):

If the property name would not be a valid JavaScript identifier or number, it must be enclosed in quotes.

I also wondered why property names were allowed to deviate away from the "may not start with a digit" rule, that applies to identifiers. That question actually reveals the complete misunderstanding that I had of property names, and is what lead me to do some more research.

Alright, seems like identifier threw me around a little bit. Seems like it's not a valid identifier but it's a valid propertyName, which includes IdentifierNames, StringLiterals and NumericLiterals
– MinusFourOct 7 '15 at 19:00

Array elements are object properties in the same way that length is a property, but trying to access an element of an array with dot notation throws 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 digit cannot be referenced with dot notation and must be accessed using bracket notation.

Now you can understand why a number for property name is valid. These are called just indexes and they are used in JavaScript arrays. And since JavaScript needs to be consistent with other languages, numbers are valid for indexes/properties names.

Parsing & Typecasting

var obj = {
lego: 'Everything is cool when you\'re part of a string.'
};
for (var key in obj) console.log(key); // "lego"

But even before that, they are parsed according to the syntax used, and transformed into a decimal literal.

var objValid = {
'022': 'alligator', // valid string literal
6: 'cow', // interpreted as decimal, evaluates to 6
.345: 'bear', // interpreted as floating-point; evaluates to 0.345
1.000: 'fox', // interpreted as floating-point, evaluates to 1
8.9890: 'owl', // interpreted as floating-point, evaluates to 8.989
000888: 'fish', // interpreted as decimal, evaluates to 888
0777: 'monkey', // interpreted as octal, evaluates to 511
0x00111: 'elephant', // interpreted as hexadecimal, evaluates to 273
0b0011: 'donkey', // interpreted as binary, evaluates to 3
};
console.log(objValid['022']); // "alligator"; as expected
console.log(objValid[022]); // undefined; 022 is an octal literal that evaluates to 18 before our lookup ever occurs
console.log(objValid[6]); // "cow"; as expected
console.log(objValid['6']); // "cow"; as expected
console.log(objValid[0777]); // "monkey"; we're accessing the property name as it was assigned (before it was parsed and typecasted)
console.log(objValid['0777']); // undefined; after parsing and typecasting, our property name seems to have disappeared
console.log(objValid['511']); // "monkey"; there it is, we found it using the evaluation of our original assignment
console.log(objValid[0x00111]); // "elephant"; we're accessing the property name as it was assigned (before it was parsed and typecasted)
console.log(objValid['0x00111']); // undefined; after parsing and typecasting, our property name seems to have disappeared
console.log(objValid['273']); // "elephant"; there it is, we found it using the evaluation of our original assignment
console.log(objValid[0b0011]); // "donkey"; we're accessing the property name as it was assigned (before it was parsed and typecasted)
console.log(objValid['0b0011']); // undefined; after parsing and typecasting, our property name seems to have disappeared
console.log(objValid['3']); // "donkey"; there it is, we found it using the evaluation of our original assignment