Chore Door - Step 64 - Why is it working?

Hi guys,

I’m currently working on this project:
https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door

In step 64 I’ve set the variable ‘currentlyPlaying’ to ‘false’:

const gameOver = (status) => {
  if (status === 'win') {
    startButton.innerHTML = 'You win! Play again?'
  }
  else {
    startButton.innerHTML = 'Game over! Play again?'
  }
  currentlyPlaying = false;
};

I don’t really understand, why this line is executed after the else block, but not in case the if-block is triggered.

Thanks and regards
Denis

this can has the following flow: do A (win) or B (loss), finally do C (currentlyPlaying to false)

after a conditional, you can perfectly have additional code which happens regardless of the condition.

Of course!
Sorry, I was completely stump…
This function is only called in specific situations and then it always has to end the game regardless of ‘win’ or ‘loss’.
Thanks! :slightly_smiling_face:

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.