I want to create a JavaScript wait()
function.
What should I edit?
function wait(waitsecs) {
setTimeout(donothing(), 'waitsecs');
}
function donothing() {
//
}
This question is related to
javascript
function
wait
You shouldn't edit it, you should completely scrap it.
Any attempt to make execution stop for a certain amount of time will lock up the browser and switch it to a Not Responding state. The only thing you can do is use setTimeout
correctly.
Source: Stackoverflow.com