Categories > Coding > Javascript >
[RELEASE] UNHOLY ISEVEN
Posted
title says it all. this works. better than a giant ass if else.
function isEven(num) {
if(num === 0) {
return true;
}
else if(num < 0) {
return isEven(-num);
}
return !isEven(num - 1);
}
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Did I mention I use arch btw?
Replied
const isEven = n => !Boolean(n % 2)
Cancel
Post
Replied
this is super unholy
Cancel
Post
https://cdn.discordapp.com/attachments/980336249820831744/1016151409261027428/standard_1.gif
https://cdn.discordapp.com/attachments/994242253864312843/1016368013534052453/standard_3.gif
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post