OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

console.log while printing timestamp of now (javascript)

  • Thread starter Thread starter Gaurav Kumar
  • Start date Start date
G

Gaurav Kumar

Guest
Why is there a difference in output in the following two cases:

1.

Code:
var myTimeStamp = Date.now()
console.log(myTimeStamp)

Code:
console.log(Date.now())

In 1st case my output is 1719474393071 whereas in 2nd case my output is 1719474393074.

<p>Why is there a difference in output in the following two cases:</p>
<p>1.</p>
<pre class="lang-js prettyprint-override"><code>var myTimeStamp = Date.now()
console.log(myTimeStamp)
</code></pre>
<ol start="2">
<li></li>
</ol>
<pre class="lang-js prettyprint-override"><code>console.log(Date.now())
</code></pre>
<p>In 1st case my output is <strong>1719474393071</strong> whereas in 2nd case my output is <strong>1719474393074</strong>.</p>
 

Latest posts

Top