-
Notifications
You must be signed in to change notification settings - Fork 543
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
Solution #373
base: master
Are you sure you want to change the base?
Solution #373
Conversation
src/modules/checkIsValidUserInput.js
Outdated
return false; | ||
} | ||
|
||
if (userInput[0] === '0') { |
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.
The 3 if statements could be joint together using an Or operation (||)
src/modules/checkIsValidUserInput.js
Outdated
|
||
const digitSet = new Set(); | ||
|
||
for (let i = 0; i < userInput.length; i++) { |
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.
Same is valid for both for loops, they can be joint together into a single one.
And can be re-written into a reduce instead, if you want
src/modules/getBullsAndCows.js
Outdated
} | ||
} | ||
|
||
for (const digit in userDigitCount) { |
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.
This works, but seems overcomplicated...
Instead of storing values to objects and them iterating, you could use only a single for loop to solve, why don't you give it a try?
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.
Awesome job, @MatheusStefan! Keep it up! 🚀
No description provided.