Ad

I don't know how to write tests for this, pls help!

Code
Diff
  • Number.prototype.evenOrOdd = function() {
      return (['Even', 'Odd'][this%2])||'Not an integer'
    }
    • const evenOrOdd=n=>(['Even', 'Odd'][n%2])||'Not an integer'
    • Number.prototype.evenOrOdd = function() {
    • return (['Even', 'Odd'][this%2])||'Not an integer'
    • }
Code
Diff
  • const evenOrOdd=n=>(['Even', 'Odd'][n%2])||'Not an integer'
    • const evenOrOdd=n=>Number.isInteger(+n)?(!(n%2)?'Even':'Odd'):'Not an integer';
    • const evenOrOdd=n=>(['Even', 'Odd'][n%2])||'Not an integer'

Made it evenOrOdd, not isEven!

Code
Diff
  • const evenOrOdd = n => Number.isInteger(+n) 
    ? (!(n%2) ? 'Even' : 'Odd') 
    : 'Not an integer';
    • const evenOrOdd = n => Number.isInteger(+n) ? !(n%2) : 'Not an integer';
    • const evenOrOdd = n => Number.isInteger(+n)
    • ? (!(n%2) ? 'Even' : 'Odd')
    • : 'Not an integer';

First time kumite

Code
Diff
  • const evenOrOdd = n => Number.isInteger(+n) ? !(n%2) : 'Not an integer';
    • const evenOrOdd = n => !(n%2)
    • const evenOrOdd = n => Number.isInteger(+n) ? !(n%2) : 'Not an integer';