Returns the primitive value of the specified object.
Syntaxobject.valueOf( )
Examples
The following example illustrates the use of the valueOf method with a date object.
var myDate = new Date();
myDate.setFullYear(2100, 5, 5);
if (myDate.getTime() == myDate.valueOf())
document.write("values are the same");
else
document.write("values are different");
Remarks
The required object reference is any intrinsic JavaScript object.
The valueOf method is defined differently for each intrinsic JavaScript object.
Object Return Value Array Returns the array instance. Boolean The Boolean value. Date The stored time value in milliseconds since midnight, January 1, 1970 UTC. Function The function itself. Number The numeric value. Object The object itself. This is the default. String The string value.The Math and Error objects do not have a valueOf method.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4