let health = 50
async function fight(){
return new Promise((resolve) => {
document.addEventListener(health<=0, resolve());
}).then(console.log('finish'))
}
function damage(){
health = health -10;
}
function addKeysEvents(){
document.addEventListener('keydown', function(event){
if (event.code == 'KeyQ'){
damage();
}
})
}