2.1.15 [ECMA-262-1999] Section 9.1, ToPrimitive

V0026:

The operator ToPrimitive takes a Value argument and an optional argument PreferredType. The operator ToPrimitive converts its value argument to a non-Object type. If an object is capable of converting to more than one primitive type, it may use the optional hint PreferredType to favour that type. Conversion occurs according to the following table:

Input Type                

Result

Undefined

The result equals the input argument (no conversion).

Null

The result equals the input argument (no conversion).

Boolean

The result equals the input argument (no conversion).

Number

The result equals the input argument (no conversion).

String

The result equals the input argument (no conversion).

__SafeArray__

__The result equals the input argument (no conversion).__

__VarDate__

__The result equals the input argument (no conversion).__

Object

Return a default value for the Object. The default value of an object is retrieved by calling the internal [[DefaultValue]] method of the object, passing the optional hint PreferredType. The behaviour of the

[[DefaultValue]] method is defined by this specification for all native ECMAScript objects ([ECMA-262-1999] section 8.6.2.6).