Issue with addEventListener not working

I am wondering why the number did not increase with the subsequent click, the purpose of the click was to increment the number by 1 after each click. The function seems to be working. Thank you for the advise in advance!

pOne.addEventListener(“click”, function(e){
console.log(addPoint());

})

function addPoint(){
let score = 0
score = score + 1
return score
}

Is defined within the function, so every time the function is called score is 0, therefore score + 1 is always 1 on every click.
https://www.w3schools.com/js/js_scope.asp

Thanks so much @eoja for the highlight! problem solved.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.