Amidery/project-lvl1-s412

View on GitHub
src/games/even.js

Summary

Maintainability
A
40 mins
Test Coverage
import { cons } from 'hexlet-pairs';
import gameLogic from '..';
import generateNum from '../utils';

const description = 'Answer "yes" if number even otherwise answer "no"';

const isEven = question => question % 2 === 0;

const game = () => {
  const question = generateNum(0, 100);
  const correctAnswer = isEven(question) ? 'yes' : 'no';
  return cons(question, correctAnswer);
};

export default () => gameLogic(description, game);