function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
Code language: JavaScript (javascript)
JavaScript Wait/Sleep Function
by
Tags:
Leave a Reply