I can't get the health variable updated..I get an update if i console.log it inside the function but it won't outside?
var health;
health = 9;
function scaringCat(event) {
var catAngry = new Audio("sounds/cat_hiss.mp3");
catAngry.play();
health = health -1;
return health;
}
buttons[1].addEventListener('click', scaringCat);
Have a look at this simple javascript code its updating health variable every time.Check console.