Reference types into the original value (the base type)

js five basic types: null, underfined, string, number, boolean

not be considered null and underfined

 

Converted to boolean

In addition to null, underfined, 0, "" are true

 

Converted into string

If toString (), call, if the returned string, the string is used, if not a string but other basic types, this value is put into a string .

If no toString (), or toString () is not the result of the basic type, the call valueOf (), if the return to the basic type, this value is put into a string.

Neither is an error.

 

Converted to a number

The order of the above toString () and valueOf () is to change over.

 

Guess you like

Origin www.cnblogs.com/yanze/p/11442611.html