Skip to content

Commit 12780fc

Browse files
committed
fixed index.js according to fallen test
1 parent 5f7d84d commit 12780fc

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/index.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import readlineSync from 'readline-sync';
1+
import readlineSync from 'readline-sync'
22

3-
const roundCount = 3;
3+
const roundCount = 3
44

55
const runEngine = (rule, getQuestionAndAnswer) => {
6-
console.log('Welcome to the Brain Games!');
7-
console.log(rule);
6+
console.log('Welcome to the Brain Games!')
7+
console.log(rule)
88

9-
const name = readlineSync.question('May I have your name? ');
10-
console.log(`Hello, ${name}!`);
9+
const name = readlineSync.question('May I have your name? ')
10+
console.log(`Hello, ${name}!`)
1111

1212
for (let i = 0; i < roundCount; i += 1) {
13-
const [question, correctAnswer] = getQuestionAndAnswer();
14-
console.log(`Question: ${question}`);
15-
const userAnswer = readlineSync.question('Your answer: ');
13+
const [question, correctAnswer] = getQuestionAndAnswer()
14+
console.log(`Question: ${question}`)
15+
const userAnswer = readlineSync.question('Your answer: ')
1616

1717
if (userAnswer !== correctAnswer) {
18-
console.log(`'${userAnswer}' is wrong answer ;(. Correct answer was '${correctAnswer}'.`);
19-
console.log (`Let's try again, ${name}!`);
20-
return;
18+
console.log(`'${userAnswer}' is wrong answer ;(. Correct answer was '${correctAnswer}'.`)
19+
console.log (`Let's try again, ${name}!`)
20+
return
2121
}
2222

23-
console.log('Correct!');
23+
console.log('Correct!')
2424
}
2525

26-
console.log(`Congratulations, ${name}!`);
27-
};
26+
console.log(`Congratulations, ${name}!`)
27+
}
2828

29-
export default runEngine;
29+
export default runEngine

0 commit comments

Comments
 (0)