This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

valueOf

Summary

Returns the primitive value of the specified object.

Syntax

valueOf()

Return Value

Returns the array instance.

Examples

In the following example, the instantiated array object is the same as the return value of this method.

var arr = [1, 2, 3, 4];
 var s = arr.valueOf();

 if (arr === s)
 document.write("same");
 else
 document.write("different");

 // Output:
 // same

See also

Specification

15.2.4.4 Object.prototype.valueOf ( ) ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

  • Microsoft Developer Network: Article