Answers for "how to get the amount of time left in a timeout javascrpit"

0

settimeout javascript see how much time is left

var timeout = setTimeout(function() {}, 3600 * 1000);

setInterval(function() {
    console.log('Time left: '+getTimeLeft(timeout)+'s');
}, 2000);

function getTimeLeft(timeout) {
    return Math.ceil((timeout._idleStart + timeout._idleTimeout - Date.now()) / 1000);
}
Posted by: Guest on July-21-2021

Code answers related to "how to get the amount of time left in a timeout javascrpit"

Code answers related to "Javascript"

Browse Popular Code Answers by Language