Tell us what’s happening:
Describe your issue in detail here.
as far as i think and see, its right and i did this multiple time
what’s the problem here,
" Sorry, your code does not pass. Don’t give up.
The text of your first .stat
element should still be XP: 0
.
"
Your code so far
<!-- User Editable Region -->
<span class="stat">XP:
<strong>
<span id="xpText">0</span>
</strong>
</span>
<span class="stat">Health:
<strong>
<span id="healthText">100</span>
</strong>
</span>
<span class="stat">Gold:
<strong>
<span id="goldText">50</span>
</strong>
</span>
<!-- User Editable Region -->
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 4
Learn to Code — For Free
1 Like
Do you have two copies of the XP and Health stats?
As was mentioned, it looks like you have duplicates.
but also there might be a spacing issue and the test could probably be more flexible with that.
I am able to pass when I place everything on the same line like so
<span class="stat">XP: <strong><span id="xpText">0</span></strong></span>
1 Like
I’ll go ahead and open an issue, because the spacing shouldn’t be too strict here for the tests
thanks,
<span class="stat">XP: <strong><span id="xpText">0</span></strong></span>
<span class="stat">Health: <strong><span id="healthText">100</span></strong></span>
<span class="stat">Gold: <strong><span id="goldText">50</span></strong></span>
this got submitted,
(i’ve tried to cut space in first .stat but it was not working and same error, but this time i did it with all and got it)
1 Like
Awesome!
Glad you were able to get it working.
Update: Issue has been created to make the spacing more flexible
opened 08:44PM - 20 Dec 23 UTC
type: bug
help wanted
scope: curriculum
### Describe the Issue
I was helping a [camper](https://forum.freecodecamp.org/… t/learn-basic-javascript-by-building-a-role-playing-game-step-4/656920) with [Step 4 of the RPG game](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-4) in the new JS curriculum and they weren't able to pass the tests because of the way they formatted their answer.
Here was their code
```html
<span class="stat">XP:
<strong>
<span id="xpText">0</span>
</strong>
</span>
<span class="stat">Health:
<strong>
<span id="healthText">100</span>
</strong>
</span>
<span class="stat">Gold:
<strong>
<span id="goldText">50</span>
</strong>
</span>
```
We should allow for that code to pass because they got it right.
Here are the current tests
https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23c1d505bfa13747c8a9b.md
For all of the tests that use `assert. equal` we should instead update it to use a regex solution with `assert.match` instead. That will make it possible for campers to submit answers with different spacing.
All of the tests with the `assert.exists` to make sure they have a `span` or `strong` element should stay the same though.
For those, interested in working on this issue, please read through the [contributing guide ](https://contribute.freecodecamp.org/#/)first.
There will be no assignment for this issue.
If you are interested in working on it, then you can submit a PR 👍
### Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-4
### Your code
```
<span class="stat">XP:
<strong>
<span id="xpText">0</span>
</strong>
</span>
<span class="stat">Health:
<strong>
<span id="healthText">100</span>
</strong>
</span>
<span class="stat">Gold:
<strong>
<span id="goldText">50</span>
</strong>
</span>
```
### Expected behavior
The following code should pass regardless of different formatting with spaces.
### 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_
2 Likes
system
Closed
June 20, 2024, 8:13am
8
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.