3 comments

[ 4.9 ms ] story [ 24.4 ms ] thread
This is a really bad idea. CPU burning while you wait. A better approach is setTimeout or requestAnimationFrame.
Why @taf2 ? setTimeout is asynchronous, code after it will be executed before the function...requestAnimationFrame is for animations.