Tell us what’s happening:
According to the instructions, I have to create call a setTimeout()
method that sets the display property to none. I have added the callback function that sets the checkpointScreen.style.display
to “none”. I have tried different combinations of parenthesis just in case it was a problem with some parser but no luck. Can you help me identify what am I missing?
Your code so far
const showCheckpointScreen = (msg) => {
checkpointScreen.style.display = "block";
checkpointMessage.textContent = msg;
if(isCheckpointCollisionDetectionActive) {
setTimeout(() => { checkpointScreen.style.display = "none"; }, 2000);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0
Challenge Information:
Learn Intermediate OOP by Building a Platformer Game - Step 103
Learn to Code — For Free
It looks like the tests are to strict here.
Replace the curly braces with parenthesis and it will pass
Also, remove the semicolon
1 Like
Glad it worked out
I also added an issue to make the tests less strict
opened 09:37PM - 02 Jan 24 UTC
type: bug
help wanted
scope: curriculum
new javascript course
### Describe the Issue
We had a [camper](https://forum.freecodecamp.org/t/learn… -intermediate-oop-by-building-a-platformer-game-step-103/660595/2) unable to pass the test, because the test is expecting parenthesis here
```js
if(isCheckpointCollisionDetectionActive) {
setTimeout(() => ( checkpointScreen.style.display = "none" ), 2000);
}
```
But this is valid code and should pass
```js
const showCheckpointScreen = (msg) => {
checkpointScreen.style.display = "block";
checkpointMessage.textContent = msg;
if(isCheckpointCollisionDetectionActive) {
setTimeout(() => { checkpointScreen.style.display = "none"; }, 2000);
}
};
```
It looks like the last test is causing issue and needs to be updated.
It should accept any valid answer.
# Note to contributors
This issue is marked available for contribution. The first comprehensive PR created will be reviewed and merged. We typically do not assign issues to anyone other than long-time contributors.
If you would like to contribute and have not read the contributors docs, please do so here: https://contribute.freecodecamp.org/#/
Here is the file you will need to change
https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb4ebdc75b3a73a43da5ec.md
If you have any issues with contributing, be sure to join us on the [contributors channel](https://discord.com/channels/692816967895220344/715074489422970962), or on the [contributors sub-forum](https://forum.freecodecamp.org/c/contributors/3)
Happy coding!
### Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-103
### Your code
```
const showCheckpointScreen = (msg) => {
checkpointScreen.style.display = "block";
checkpointMessage.textContent = msg;
if(isCheckpointCollisionDetectionActive) {
setTimeout(() => { checkpointScreen.style.display = "none"; }, 2000);
}
};
```
### Expected behavior
The code above should pass.
The test is to strict and expects a different result.
### Screenshots
_No response_
### System
- Device: [e.g. iPhone 6, Laptop]
- OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
- Browser: [e.g. Chrome, Safari]
- Version: [e.g. 22]
### Additional context
_No response_
system
Closed
July 3, 2024, 10:01am
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.