80
JavaScript Date valueOf() method
The JavaScript date valueOf() method returns the primitive value of a Date object.
Syntax
The valueOf() method is represented by the following syntax:
Return
A primitive value of a Date object.
JavaScript Date valueOf() method example
Here, we will understand valueOf() method through various examples.
Example 1
Let’s see an example to fetch primitive value of a Date object.
Output:
1533815687148
Example 2
Let’s see an example to fetch primitive value of the specified Date object.
Output:
-706266470000
Example 3
Let’s see one more example to fetch the primitive value of the specified Date object.
Output:
1534344730000
Next TopicJavaScript Date