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

added solution #234

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

sheva10barca
Copy link

No description provided.

Copy link

@VitaliyBodnar VitaliyBodnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done!

Comment on lines 7 to 9
while (usedDigits.size < 4) {
const randomDigit = Math.floor(Math.random() * 10);

Copy link

@VitaliyBodnar VitaliyBodnar Aug 26, 2023

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

return;
}

if (result.bulls === 4) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (result.bulls === 4) {
if (result.bulls === NUMBER_LENGTH) {

'use strict';

const validateInput = (input) => {
return /^\d{4}$/.test(input) && new Set(input).size === 4;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return /^\d{4}$/.test(input) && new Set(input).size === 4;
return /^\d{4}$/.test(input) && new Set(input).size === NUMBER_LENGTH;

Copy link

@lerastarynets lerastarynets left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants