JS: Primitive Value
Primitive Value
A primitive value is a value whose Type is a primitive type.
The following values are “Primitive Values”.
Primitive Value Object Wrapper
Most primitive type have corresponding object of object type.
The object is used as primitive value wrapper.
This allows you to call methods on them, such as "abc".length
.
You can create number, string, boolean, objects yourself. (but is not useful.) For example:
new String(arg)
〔see String Constructor〕
new Number(arg)
〔see Number Constructor〕
new Boolean(arg)
〔see Boolean Constructor〕
Convert Primitive Value to Object
Use
Object(val)
〔see Object Constructor〕