P. 1
ECMA-262

ECMA-262

|Views: 23|Likes:
Publicado porsusloka
ECMA standard
ECMA standard

More info:

Published by: susloka on May 07, 2008
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

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).

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 (8.6.2.6).

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->