Number Checker
Create boolean helper functions that describe a number.
5 upvotes
10 upvotes
Number Checker
Given a number, return a small report describing what kind of number it is. Use simple boolean helper functions, then combine their results in describeNumber.
Write these functions:
isPositive(number)should returntruewhen the number is greater than0.isNegative(number)should returntruewhen the number is less than0.isZero(number)should returntruewhen the number is exactly0.isEven(number)should returntruewhen the number is even.describeNumber(number)should return an object withpositive,negative,zero,even, andoddproperties.
Sample checks:
Expected output:
Each checker function should return a boolean. The summary function should return a new object.
Solution
Solution:
