DEV Community

loading...

Discussion on: JavaScript Katas: Find Odd Digits

Collapse
jpantunes profile image
JP Antunes

And now in one single (almost readable) line!

const odds = (n, k) => n > Math.max(0, k) ? Number([...`${n}`].filter(num => num % 2).join('').slice(0, k)) : 0