Javscript the definitive guide 6th edition 阅读随记

6.2.1 Objects As Associative Arrays
When you use the . operator to access
a property of an object, however, the name of the property is expressed as an identifier.
Identifiers must be typed literally into your JavaScript program; they are not a datatype,
so they cannot be manipulated by the program.
On the other hand, when you access a property of an object with the [] array notation,
the name of the property is expressed as a string. Strings are JavaScript datatypes, so
they can be manipulated and created while a program is running


 

这里提到identifier 不是一种datatype,这里可能有些人感到迷惑,标识符是在语言被编译或解释的过程的前期(词法分析阶段完成的),而数据类型的确立基本是在中期(语义分析)了,所以明白这一点就好理解了。

虽然js是动态语言,但是有些基本的编译规则我想应该也是共通的。

你可能感兴趣的:(script)