0
Snail In the Well JS unexpected identifier
Hi all! I'm not looking for a direct solution to the whole problem, just a syntax error in having. Here is my code: function main() { var depth = parseInt(readLine(), 10); //your code goes here var day = 7; var night = -2; var dist = 0; for (i = 0; i <= depth; i++) { if dist >= depth { console.log(i); } else dist += day; if dist >= depth { console.log(i); } else dist += night; } }; My question is: I'm getting a syntax error on line 8 saying that "dist" is an unexpected identifier. However, I declared var dist in line 6. Can anyone help me understand why this is problematic? Thanks!
0 Respuestas