3 ms·
That's the first "wait, what?". However, if you actually try and work out that horrible if statement !((_ok) ? true : (Math.random() > 0.1)) _ok ? fal
by shawabawa3 13y ago
That's the first "wait, what?". However, if you actually try and work out that horrible if statement
!((_ok) ? true : (Math.random() > 0.1))
_ok ? false : !(Math.random() > 0.1)
!_ok && Math.random() <= 0.1
Seems fine...until you realise that this is the condition to exit early, it's still logging 90% of the time which is almost certainly not the desired behavior.
Not to mention _ok is a terrible name for that variable, and it's only ever being used as a negation. Why isn't it called _error or something?