Comment Comment by IncreasePosts You want to implement your own is-odd in your code - simple, right? isOdd = (x) => x % 2 == 1Ut oh, your code is broken for negative numbers now since % isn't a true modulo operator...Fine then, isOdd = (x) => x % 2 != 0Ut oh, your code is broken because isOdd("hi") returns true now...Fine then, isOdd = (x) => if(!isNumber(x)) throw... else return x%2 != 0Ut oh, your code is now broken because isOdd(2^55+1) returns true now... parent IncreasePosts 1 month ago
Ut oh, your code is broken for negative numbers now since % isn't a true modulo operator...
Fine then, isOdd = (x) => x % 2 != 0
Ut oh, your code is broken because isOdd("hi") returns true now...
Fine then, isOdd = (x) => if(!isNumber(x)) throw... else return x%2 != 0
Ut oh, your code is now broken because isOdd(2^55+1) returns true now...