-
Notifications
You must be signed in to change notification settings - Fork 530
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
added solution #234
base: master
Are you sure you want to change the base?
added solution #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done!
src/generateRandomNumber.js
Outdated
while (usedDigits.size < 4) { | ||
const randomDigit = Math.floor(Math.random() * 10); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 and 10 are a 'magic numbers', so please move them to the variables
src/handlePlayRound.js
Outdated
return; | ||
} | ||
|
||
if (result.bulls === 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (result.bulls === 4) { | |
if (result.bulls === NUMBER_LENGTH) { |
src/validateInput.js
Outdated
'use strict'; | ||
|
||
const validateInput = (input) => { | ||
return /^\d{4}$/.test(input) && new Set(input).size === 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return /^\d{4}$/.test(input) && new Set(input).size === 4; | |
return /^\d{4}$/.test(input) && new Set(input).size === NUMBER_LENGTH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're showing incredible skills, keep it going!
No description provided.