Answers for "setTimeout but for a given time"

0

setinterval vs settimeout in javascript\

var intervalID = scope.setInterval(func, [delay, arg1, arg2, ...]);
var intervalID = scope.setInterval(function[, delay]);
var intervalID = scope.setInterval(code, [delay]);
Posted by: Guest on December-10-2020
0

setTimeout but for a given time

function setToHappen(fn, date){
    return setTimeout(fn, date - Date.now());
}
Posted by: Guest on April-22-2021

Browse Popular Code Answers by Language