dimassspb/frontend-project-lvl1

View on GitHub
src/games/even.js

Summary

Maintainability
A
35 mins
Test Coverage
import runGame from '../index.js';
import random from '../random.js';

const description = 'Answer "yes" if the number is even, otherwise answer "no".';
const isEven = (num) => num % 2 === 0;
const getData = () => {
  const question = random(0, 10);
  const correctAnswer = isEven(question) ? 'yes' : 'no';
  return [question, correctAnswer];
};
export default () => runGame(description, getData);