The score is not updating. Please help me make the score update. When I click the button with the function for 'addScore', the displayed score will not change to a new one.
I have tried a lot of things. Non of which have worked
var score = 0;
function addScore(){ score ++ }
function drawScore() {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.font = "16px Arial";
ctx.fillStyle = "red";
ctx.fillText("Score: " +score, 8, 20);
}
drawScore();
I am expecting it to update the score, but it does not. It remains at 0.
The problem has been solved bu the text keeps increasing and over laps it.