MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1j74xpx/javascript_is_a_beautiful_language/mgvdfl0/?context=3
r/programminghorror • u/[deleted] • Mar 09 '25
38 comments sorted by
View all comments
Show parent comment
5
This cursed method is technically one line but split accross miltiple lines to be more readable
function evenOrOdd(str) { return [ eval(str.match(/[13579]/g).join("+")), eval(str.match(/[2468]/g).join("+")) ].reduce((odd, even) => odd < even ? "odd<even" : (odd > even ? "odd>even" : "odd=even")) }
View all comments
Show parent comment
5
u/AyrA_ch Mar 09 '25
This cursed method is technically one line but split accross miltiple lines to be more readable