The left side of the comparison determines if the variable is NOT an "existing"true or an "integer""not a decimal", the result is undefined
true
"not a decimal
undefined
If the left of the comparison fails, then we move to the right comparison
If the integer is odd then return false, else return true.
Because this is kumite. Here it's about showing off skills related to the knowledge of tricks to reduce the length of the code as much as possible, I think. Of course, in "normal" code readability is very important.
Why you dont return simple undefined instead od {}.a ?
I mean: isEven=n=> n%1==0 ? !(n%2) : undefined
and this is more readability. When you put some whitespace beetween
0
Well done! I didn't know the trick {}.a for undefined...
Loading collection data...
The left side of the comparison determines if the variable is NOT an "existing"
true
or an "integer""not a decimal
", the result isundefined
If the left of the comparison fails, then we move to the right comparison
If the integer is odd then return false, else return true.
Because this is kumite. Here it's about showing off skills related to the knowledge of tricks to reduce the length of the code as much as possible, I think. Of course, in "normal" code readability is very important.
Why you dont return simple undefined instead od {}.a ?
I mean:
isEven=n=> n%1==0 ? !(n%2) : undefined
and this is more readability. When you put some whitespace beetween
0
Well done! I didn't know the trick {}.a for undefined...