From a0614749d85435d1000ef8ae04f130b8b1c420ff Mon Sep 17 00:00:00 2001 From: Oleksii Bieliaiev Date: Tue, 19 Sep 2023 15:33:20 +0300 Subject: [PATCH] Solution --- src/app.js | 2 +- src/numberGenerator.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app.js b/src/app.js index 8d5b093..43feca4 100644 --- a/src/app.js +++ b/src/app.js @@ -17,7 +17,7 @@ const handleGameStart = (enteredNumber) => { const secretNumber = numberGenerator(); - console.log(secretNumber, enteredNumber); + console.log(`The secret number is ${secretNumber}`); if (enteredNumber === secretNumber) { console.log('You win!'); diff --git a/src/numberGenerator.js b/src/numberGenerator.js index 585f7de..b9cf3e7 100644 --- a/src/numberGenerator.js +++ b/src/numberGenerator.js @@ -1,10 +1,13 @@ 'use strict'; +const numberLength = 4; +const toInteger = 10; + const numberGenerator = () => { const numbersArr = []; - while (numbersArr.length < 4) { - const num = Math.floor(Math.random() * 10); + while (numbersArr.length < numberLength) { + const num = Math.floor(Math.random() * toInteger); if (!numbersArr.includes(num)) { numbersArr.push(num);