g1yk/project-lvl1-s486

View on GitHub
src/games/even.js

Summary

Maintainability
A
0 mins
Test Coverage
import { cons } from 'hexlet-pairs';
import game from '../core';
import randomInteger from '../utils';

const isNumberEven = num => ((num % 2 === 0));

const description = () => {
  const question = randomInteger(0, 25);
  const correctAnswer = isNumberEven(question) ? 'yes' : 'no';

  return cons(question, correctAnswer);
};
const intro = 'Answer "yes" if number even otherwise answer "no"';

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