javascript execute after 1 second code example
Example 1: javascript run something after x seconds
setTimeout(function(){
location.reload();
}, 3000); //run this after 3 seconds
Example 2: js after 1 second
const now = new Date();
now.setSeconds(now.getSeconds() + 1)
Example 3: js after settimeout
function doHomeWork(subject, callback){
setTimeout(callback,500);
console.log("doing my homework:", subject)
}
doHomeWork("Maths", function(){console.log("finished my homework");});