Comment on Ask HN: Can someone explain why this line exists?parentComments−zaroth13yUpvote to you, and downvote to whoever wrote that line of code.A ternary inside an 'if' statement, really? And even more so when one of the return values is 'true'?Relax, it's just a bug, right? But it would be nice if programmers practiced basic Boolean reduction in their 'if' statements...(!((_ok) ? true : (Math.random() > 0.1)))!((_ok) ? true : (Math.random() > 0.1))_ok ? false : !(Math.random() > 0.1)!_ok && Math.random() <= 0.1
Comments
Upvote to you, and downvote to whoever wrote that line of code.
A ternary inside an 'if' statement, really? And even more so when one of the return values is 'true'?
Relax, it's just a bug, right? But it would be nice if programmers practiced basic Boolean reduction in their 'if' statements...
(!((_ok) ? true : (Math.random() > 0.1)))
!((_ok) ? true : (Math.random() > 0.1))
_ok ? false : !(Math.random() > 0.1)
!_ok && Math.random() <= 0.1