Boolean.prototype.valueOf

Returns the primitive value of the object.

Syntax

valueOf()

Return value

A primitive boolean value (true or values).

Examples

var boolObject = new Boolean(true)
var boolPrimitive = boolObject.valueOf()
print("Object's type is", typeof boolObject)
print("Primitive's type is", typeof boolPrimitive)
print("Equal?", boolObject == boolPrimitive)
print("Strictly equal?", boolObject === boolPrimitive)
Object's type is object
Primitive's type is boolean
Equal? true
Strictly equal? false

typeof new Boolean(true).valueOf()