DEV Community

loading...

Discussion on: What’s your alternative solution? Challenge #18

Collapse
aabbccsmith profile image
alistair smith

Short and sweet, code golf style!

const isPrime=n=>[...Array(n-2)].map((_,i)=>i+2).filter(i=>n%i==0).length==0