Object.valueOf()

JavaScript 1.1+, JScript 3.0+ Nav3+, NES2+, IE 4+, Opera3+ Syntax

							object.valueOf()

Description

The valueOf() method for the Object object is used to obtain the value of the specified object.

Example

Listing 6.198 shows how the valueOf() method is used.

Listing 6.198 Example of the valueOf() Method
<html>
<body>

<script language="JavaScript">
<!––Hide

// declare an age variable which contains a Number object.
var age = Number(30);

// calculate the valueOf the variable and output to the document.
document.write(age.valueOf());
// End Hide ––>
</script>

</body>
</html>
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.