If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

An object property can only be accessed by the "dot" notation if its name conforms to the rules concerning valid names for javascript variables. In your case, a variable that begins with '5' is illegal as a js variable name.

However, with the square bracket notation the property name doesn't have to conform to the naming conventions. That's what is happening. An object can be given some property names that cannot be accessed by the "dot" method.

An object property can only be accessed by the "dot" notation if its name conforms to the rules concerning valid names for javascript variables. In your case, a variable that begins with '5' is illegal as a js variable name.

However, with the square bracket notation the property name doesn't have to conform to the naming conventions. That's what is happening. An object can be given some property names that cannot be accessed by the "dot" method.

thanks Tcobb...but I don't know why this is illegal.
I am reading <javascript: the definite guide>section7.3

Section 7.3. Objects as Associative Arrays
You've seen the . operator used to access the properties of an object. It is also
possible to use the [] operator, which is more commonly used with arrays, to
access these properties. Thus, the following two JavaScript expressions have the
same value:

object.property
object["property"]

The important difference to note between these two syntaxes is that in the first,
the property name is an identifier, and in the second, the property name is a
string. You'll see why this is so important shortly.