← Back to challenges

Even or Odd Number of Factors

JavaScriptHardmathvalidationlogic

Instructions

Create a function that returns "even" if a number has an even number of factors and "odd" if a number has an odd number of factors.

Examples

factorGroup(33) ➞ "even"

factorGroup(36) ➞ "odd"

factorGroup(7) ➞ "even"

Notes

  • You don't need to actually calculate the factors to solve this problem.
  • Think about why a number would have an odd number of factors.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Zip It, If You Can?