Learn Intermediate OOP by Building a Platformer Game - Step 103

Tell us what’s happening:

I’m not sure why I can’t pass step 103. Is my syntax wrong or something? Can someone help me out? I’m having problems with this line of code: setTimeout(() => checkpointScreen.style.display = “none”, 2000);

const showCheckpointScreen = (msg) => {
  checkpointScreen.style.display = "block";
  checkpointMessage.textContent = msg;
  if (isCheckpointCollisionDetectionActive) {
    setTimeout(() => checkpointScreen.style.display = "none", 2000);
  }
};

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 103

Hey @bryankhor07
You need a clossing bracket ) becore the comma

1 Like

It doesn’t work. I don’t think the parentheses is the problem.

1 Like

Post the updated code please

1 Like
const showCheckpointScreen = (msg) => {
  checkpointScreen.style.display = "block";
  checkpointMessage.textContent = msg;
  if (isCheckpointCollisionDetectionActive) {
    setTimeout((() => checkpointScreen.style.display = "none"), 2000);
  }
};

The test expects the assignment to be enclosed in parentheses (or more precisely, the implicit return containing an assignment, to be enclosed).

setTimeout(() => (bla = blabla), 1000);

That is how Prettier would format it as well, but it shouldn’t be required. There is an issue open for it.

1 Like

Ah I see. Got it thanks!