object -> primitive conversion
Last updated
Was this helpful?
Last updated
Was this helpful?
⟩ ⟩ ⟩ ⟩ object -> primitive
JS spec defines 3 algorithms for object -> primitive conversion:
:preferring a string (if conversion is possible)
:preferring a number (if conversion is possible)
:classes choose their own preference.
object -> : falsy values
object -> :
object -> :
call ()
object -> primitive algorithms are involved in:
object -> primitive algorithms may result in
- object to string.
- object to (primitive) value, if exists.