isEven: Overly Complicated vs. Simple

Two functions, identical behavior, wildly different approaches.

Live Demo

Enter a number to see both functions in action
Overly Complicated
// Uses needless recursion instead of modulo
function isEven(n) {
  // Base case: zero is even
  if (n === 0) return true;
  // Base case: negative one is odd
  if (n === -1) return false;

  // Recurse by subtracting 2
  if (n > 0) return isEven(n - 2);
  return isEven(n + 2);
}
Result:
Simple & Obvious
// The obvious, correct approach
function isEven(n) {
  return n % 2 === 0;
}
Result:

Proof Across Multiple Values

Input Overly Complicated Simple Match?