DEV Community

Discussion on: Daily Challenge #255 - Is There an Odd Bit?

Collapse
 
jpantunes profile image
JP Antunes • Edited

JS one liner

const isOdd = (num, i = 1) => num >= 1 ? (i % 2 == 1 && parseInt(num / 2) % 2 == 1) : isOdd(parseInt((num / 2), i++))