About private names
getify at gmail.com
Sun Mar 20 15:34:26 PDT 2011
> BTW, if you know that a property name is foo, why would you ever code
> obj["foo"] instead of obj.foo?
The most obvious reason is if the name of the property contains a character
which cannot be an identifier character in the property name... like a
unicode character, for instance.
> Without private names there is no particular reason to say obj['foo']
> rather than obj.foo but there is a very important distinction between
> obj[foo] and obj.foo.
Are we talking about the difference between obj['foo'] and obj[foo]? I think
perhaps that was a subtle shift in this conversation that I missed until
Without private names, is there (and what is it?) an important distinction
1. obj[foo] and obj.foo; AND
2. obj['foo'] and obj.foo
More information about the es-discuss