Ad
Code
Diff
  • function isEven(input) {
      if(!Number.isInteger(input)) {
        return undefined
      }
      return input.toString(2).at(-1) == false
    }
    • isEven = x => [!0,!1][x%2]
    • // Previous iteration
    • //isEven = x => [true,false][x%2]
    • // Previous iteration
    • //const isEven = x => !(Number.isInteger(+x))? undefined : !(x%2)
    • // Previous iteration
    • // isEven = x => !x || !Number.isInteger(x) ? undefined : x % 2 ? false : true;
    • // Previous iteration
    • // isEven = x => x!=~~x?undefined:!(x%2);
    • // Previous iteration
    • // isEven = num => num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
    • // Previous iteration
    • // function isEven(num) {
    • // return num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
    • function isEven(input) {
    • if(!Number.isInteger(input)) {
    • return undefined
    • }
    • return input.toString(2).at(-1) == false
    • }
Code
Diff
  • const helloWorld = n => 'Hello ' + n
    • const helloWorld = n => ('Hello ' + n)
    • const helloWorld = n => 'Hello ' + n