Javascript wait() function [closed]
Javascript isn’t threaded, so a “wait” would freeze the entire page (and probably cause the browser to stop running the script entirely). To specifically address your problem, you should remove the brackets after donothing in your setTimeout call, and make waitsecs a number not a string: console.log(‘before’); setTimeout(donothing,500); // run donothing after 0.5 seconds console.log(‘after’); … Read more