mishalisovskiy/project-lvl1-s438

View on GitHub
src/utils.js

Summary

Maintainability
A
0 mins
Test Coverage
export const getNumber = (min, max = 0) => Math.floor((Math.random() * max) + min);

export const buildYesOrNoFunc = (predicateFunc, min, max) => {
  const question = `${getNumber(min, max)}`;
  const answer = predicateFunc(Number(question)) ? 'yes' : 'no';
  return { question, answer };
};