r/programminghorror • u/AntiMatterMode • Jul 10 '26
Javascript code that also self-describes the feeling it evokes when looking at it
208
Upvotes
r/programminghorror • u/AntiMatterMode • Jul 10 '26
82
u/AntiMatterMode Jul 10 '26
…die
7
u/virtualrandomnumber Jul 10 '26
For my understanding:
destructures the
dieobject to create a new one with theisHeldproperty flipped? Is it necessary to return a new object or is it just to keep the lambda in one expression? Otherwise, the caveman way to write it would be:3
u/Prudent_Ad_4120 Jul 10 '26
do dice die?
20
u/anoppinionatedbunny Jul 10 '26
damn, that horrible ternary could have been a filter before the map. if you're going to use monads, go all in
1
u/_xonde_ Aug 01 '26
Tbh the more I look at it the more sense it makes, is there really a more succinct way to write this?
1
u/Ksorkrax Jul 10 '26
Did Sideshow Bob wrote this?
1
u/sudoregalia Jul 12 '26
billions must use nested single line lambdas
1
u/-Redstoneboi- Jul 11 '26
i love functional programming... every single step of this function makes perfect sense as you write it but it takes 5 times longer to review when pieced together
34
u/[deleted] Jul 10 '26
[removed] — view removed comment
2
u/[deleted] Jul 10 '26
[removed] — view removed comment