The actual primitive value
Converts the object into a primitive
Often just returns the class name
Converts the primitive into it's JSON representation
Will be one of:
JSON.stringify()
was directly called on this objectthe object to serialize with JSON.stringify
Converts the primitive into it's string representation. Often has a unit value associated with it such as 125ms
Primitives must implement the legacy valueOf
interface. Usually just forwards to the newer
Symbol.toPrimitive
API
The interface for a primitive value. The actual value can always be retrieved by doing
primitive.value
but all primitives implement theSymbol.toPrimitive
interface so are naturally convertible tostring
andnumber
.