r/shittyprogramming • • Jun 07 '21
isEven with regex in javascript
const isEven = n => 'x'.repeat(n).replace(/xx/g, '') === '';
102
Upvotes
r/shittyprogramming • • Jun 07 '21
const isEven = n => 'x'.repeat(n).replace(/xx/g, '') === '';
View all comments
2
u/MarceauKa Jun 07 '21
I don't even know why I tested that...