JavaScript program to show current time in milliseconds


Following program shows you how to print current time in milliseconds.
We can get current milliseconds using new Date().getTime() in JavaScript.

function getTime() {
  var d = new Date().getTime();
  console.log(d);
}

getTime();

Output:

 1626516286218

Try it online here https://onecompiler.com/javascript/3x5qaam2m