JavaScript The Definitive Guide Note Part 2

3.13. Primitive Datatype Wrapper Objects

each of the three key primitive datatypes has wrapper , that cantains the save primitive data value, but it also defines properties and mathods. when you try to access a property or method of the primitive datatypes, JavaScript internally creates a wrapper object for it.

eg. var len = s.length; s remains a string, a new transient String object is created for you to access the length property, and then the trainsient object is discarded.

3.14. Object-to-Primitive Conversion

非null的object转成Boolean时,就被转换成true.

object转成数字的时候,是调用valueOf()方法,如果没有返回一个primitive value,将调用toString()方法把string转成number

 

你可能感兴趣的:(JavaScript,Access)