3 comments

[ 3.0 ms ] story [ 19.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.