const startGame = () => {
return new Promise((res,rej) => {
while(health >= 0){
console.log("ATTACKED")
console.log(health)
if (health === 0) {
res('GAME OVER')
break;
}
health--
}
})
}
const isOver = startGame()
if(isOver){ console.log(isOver) }}