変数 n がグローバル変数の場合、以下の if ステートメントで未定義になるのはなぜですか?
function aisaRev() {
n=n; //globally n=0
console.log(n);
hover=1;
rev=2;
//n counts up to 39 and then becomes undefined when it hits the else statement
if (n<=aisaArray.length){n++}else{n=0; console.log(n)};
world();
}