Skip to content

Commit

Permalink
Random number now generates only when app starts
Browse files Browse the repository at this point in the history
  • Loading branch information
davinnchii committed Oct 3, 2023
1 parent fba6258 commit 098946f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const { terminal } = require('./terminal');
const { generateNumber } = require('./numberGenerator');
const { checkAnswer } = require('./checkAnswer');
const searchedNumber = generateNumber();

function gameStart() {
terminal.question('Enter a number: ', (userInput) => {
Expand All @@ -14,8 +15,6 @@ function gameStart() {
return;
}

const searchedNumber = generateNumber();

if (userInput === searchedNumber) {
console.log('You won!', `Searched number was: ${searchedNumber}`);
terminal.close();
Expand Down

0 comments on commit 098946f

Please sign in to comment.