JavaScript: stop execution untill delay is over
问题 My code is something like this:- function doStuff(){ // Note:- this funcion take 50ms for ececution as i have put // timeout setTimeout(function(){ // some line of code .... }, 50); return; } doStuff(); console.log('This should execute after doStuff() complete its work.") // after that more many lines of code and more stuff are here ..... ..... Now what I want is, as you can see here that doStuff() takes 50ms of time to execute so the code which is after doStuff() it should execute after