← Back to challenges

Is the Number Even or Odd?

JavaScriptHardmathvalidationnumbersconditions

Instructions

Create a function that takes a number as an argument and returns "even" for even numbers and "odd" for odd numbers.

Examples

isEvenOrOdd(3) ➞ "odd"

isEvenOrOdd(146) ➞ "even"

isEvenOrOdd(19) ➞ "odd"

Notes

  • Dont forget to return the result.
  • Input will always be a valid integer.
  • Expect negative integers (whole numbers).
  • Tests are case sensitive (return "even" or "odd" in lowercase).
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Fix the Error: Check Whether a Given Number Is Odd