I want to add 10 to 0 every time I click a button and show it on the screen. I've tried everything but I can't get it to work.
This belongs to a longer code:
var bet = 0;
pen.fillText('Bet: ' + bet, 350, 390);
function reactToBetIncrease() {
bet += 10;
}
reactToBetIncrease(). The calling context will matter a lot in your case. Is thebetvariable a global (part of thewindowobject)?