how to execute sleep function inside a loop:
async function show(){
showdiv()
await sleep(5000)
hideDiv()
await sleep(5000)
}
function showDiv(){
$('div').fadeIn()
}
function hideDiv(){
$('div').fadeOut()
}
function sleep(second){
return new Promise(resolve => setTimeout(resolve, second));
}
var i = 0
while(i++<10){
show()
}
How excatly i can excute the sleep function ?
I search here but didn't found something relevant or didn't understand it.
Please help!