r/shittyprogramming • u/CVh655FDBcZ1l • Apr 10 '19
One Line of Code™
https://gist.github.com/WorryingWonton/ce8a3a74b0298f0b734fe4dd0a883a63
101
Upvotes
r/shittyprogramming • u/CVh655FDBcZ1l • Apr 10 '19
View all comments
2
u/mindbleach Apr 11 '19
return input.map( (v,i,a) => { if(v==13){ return 0 } if(a[i-1]==13){ return 0 } return v } ).reduce( (a,e) => a+e )
JS, but still - the fuck?