JavaScript if/else statements are altering variables used as conditions in the same statements
This is happening because you are assigning the value in the if check. instead of assigning it using =
, use ==
or ===
to check for equality
if (day = 0) // incorrect
if (day == 0) // correct