aldarg/project-lvl1-s508

View on GitHub
src/games/even.js

Summary

Maintainability
A
1 hr
Test Coverage
import startGame from '..';
import getRandomInt from '../utils';

const description = 'Answer "yes" if number even otherwise answer "no".';
const min = 1;
const max = 100;

const isEven = n => (n % 2 === 0);

const makeTest = () => {
  const question = getRandomInt(min, max);
  const answer = isEven(question) ? 'yes' : 'no';

  return { question, answer };
};

export default () => {
  startGame(description, makeTest);
};