What is the JavaScript version of sleep()?

Is there a better way to engineer a sleep in JavaScript than the following pausecomp function (taken from here)? function pausecomp(millis) { var date = new Date(); var curDate = null; ...