How to use ValueOf in Javascript
In this article I am going to explain about ValueOf() method in JavaScript.
JavaScript ValueOf() Method
JavaScript ValueOf() method use for find primitive value of Date object. When its function execute primitive value will return in the form of millisecond since 1 January 1970.
Syntax
Example
<html>
<head>
<script type="text/javascript">
function myfun() {
var dd = new Date();
var mm = document.getElementById("tst");
mm.innerHTML = dd.valueOf();
}
</script>
</head>
<body>
<p>
click button to show primitive value</p>
<h3 id="tst" style="color: red">
</h3>
<button onclick="myfun()">
click me</button>
</body>
</html>
|
Output

You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here