KH test

Page 125

3.

Return the String value that is the result of concatenating the three Strings "[object ", class, and "]".

15.2.4.3

Object.prototype.toLocaleString ( )

When the toLocaleString method is called, the following steps are taken: 1. 2. 3. 4.

Let O be the result of calling ToObject passing the this value as the argument. Let toString be the result of calling the [[Get]] internal method of O passing "toString" as the argument. If IsCallable(toString) is false, throw a TypeError exception. Return the result of calling the [[Call]] internal method of toString passing O as the this value and no arguments.

NOTE 1 This function is provided to give all Objects a generic toLocaleString interface, even though not all may use it. Currently, Array, Number, and Date provide their own locale-sensitive toLocaleString methods. NOTE 2 The first parameter to this function is likely to be used in a future version of this standard; it is recommended that implementations do not use this parameter position for anything else.

15.2.4.4

Object.prototype.valueOf ( )

When the valueOf method is called, the following steps are taken: 1. 2. 3.

Let O be the result of calling ToObject passing the this value as the argument. If O is the result of calling the Object constructor with a host object (15.2.2.1), then a. Return either O or another value such as the host object originally passed to the constructor. The specific result that is returned is implementation-defined. Return O.

15.2.4.5

Object.prototype.hasOwnProperty (V)

When the hasOwnProperty method is called with argument V, the following steps are taken: 1. 2. 3. 4. 5.

Let P be ToString(V). Let O be the result of calling ToObject passing the this value as the argument. Let desc be the result of calling the [[GetOwnProperty]] internal method of O passing P as the argument. If desc is undefined, return false. Return true.

NOTE 1

Unlike [[HasProperty]] (8.12.6), this method does not consider objects in the prototype chain.

NOTE 2 The ordering of steps 1 and 2 is chosen to ensure that any exception that would have been thrown by step 1 in previous editions of this specification will continue to be thrown even if the this value is undefined or null.

15.2.4.6

Object.prototype.isPrototypeOf (V)

When the isPrototypeOf method is called with argument V, the following steps are taken: 1. 2. 3.

If V is not an object, return false. Let O be the result of calling ToObject passing the this value as the argument. Repeat a. Let V be the value of the [[Prototype]] internal property of V. b. if V is null, return false c. If O and V refer to the same object, return true.

NOTE The ordering of steps 1 and 2 is chosen to preserve the behaviour specified by previous editions of this specification for the case where V is not an object and the this value is undefined or null.

Š Ecma International 2009

115


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.