Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dice Game - Step 16: regex too strict #54744

Closed
lasjorg opened this issue May 12, 2024 · 0 comments · Fixed by #54778
Closed

Dice Game - Step 16: regex too strict #54744

lasjorg opened this issue May 12, 2024 · 0 comments · Fixed by #54778
Labels
help wanted Open for all. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@lasjorg
Copy link
Contributor

lasjorg commented May 12, 2024

Describe the Issue

Valid code will fail and give the wrong assert message about using Math.floor which is confusing.

Math.floor((Math.random() * 6) + 1);

Expected

Math.floor(Math.random() * 6) + 1;

If you search for articles on Math.random you will find many of the examples has the min value inside the Math.floor method, this includes MDN, fCC news articles, etc.

  • The min value should be allowed inside the floor method.
  • Update the regex that checks for Math.floor to not depend on the rest of the code structure to avoid false positives.

Tests: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657c9f0af0e3d61abde1c005.md

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/step-17

Your code




Expected behavior

Valid code should pass and not throw unrelated assert messages.

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

Forum: https://forum.freecodecamp.org/t/learn-intermediate-algorithmic-thinking-by-building-a-dice-game-step-17/689837

@lasjorg lasjorg added type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. new javascript course These are for issues dealing with the new JS curriculum labels May 12, 2024
@jdwilkin4 jdwilkin4 added help wanted Open for all. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants