javascript - NaN error and number staying the same -


i attempting re-write plug.dj mc server & friends, need wit code. new stackoverflow, forgive errors.

code:

function voteyes() {  var yes;  yes = yes + 1  window.alert(yes); } 

when window pops up, displays "1" always, without adding 1 , displaying "nan" ( know means not number ). want add vote system. if "yes" exceeds 1 or 2 switches video. thanks!

var yes =0;  function voteyes() {   //var yes;   yes = yes + 1   window.alert(yes);  }

i can't add comment suggestion should initialize yes before using i.e.

var yes = 0; yes = yes+1 ;

and whatever want


Comments