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
8
u/AndreasKralj Jun 07 '21
Can you explain what this is doing please?