The getSeconds()
method returns the seconds of a date as a number (0-59):
Example
const d = new Date();
document.getElementById("demo").innerHTML = d.getSeconds();
document.getElementById("demo").innerHTML = d.getSeconds();
Practice Excercise Practice now