The getMilliseconds() method returns the milliseconds of a date as a number (0-999):

Example

const d = new Date();
document.getElementById("demo").innerHTML = d.getMilliseconds();



Practice Excercise Practice now