my program is broken please help | SoloLearn: Learn to code for FREE!

+2

my program is broken please help

here it is, god: https://code.sololearn.com/WkW6w6fh3XBk/?ref=app

6/3/2020 9:42:19 PM

JS Coder

7 Answers

New Answer

+2

var money = 0 function increaseScore() { var elm = document.getElementById("lol"); money = money + 1; elm.innerHTML = money; }

+2

when you do var money=money +1 ; Variable money is defined again but not intialized with any value so in var money=money +1 adding 1 to money returns NaN; Here is link for why that happened https://stackoverflow.com/questions/42441315/js-on-click-function-add-number-to-variable-gives-nan

+1

var money = money +1;

+1

var money = 0 function increaseScore() { var elm = document.getElementById("lol") money = money + 1 elm.innerHTML = money }

0

Abhay i don't know what was fixed

0

Abhay I did it but when I click a increase money amount of money said "NaN"

0

Abhay btw I learned how to increase variables in grasshopper a app,