Red carpet rolled out in Essex for presidential visitors to meet King
Baby girl fights for life as meningitis outbreak spreads: Fears grow of 'second wave' as students flee home for early Easter and reveller reveals bug was in Ground Zero club even earlier than thought
Iran's cyberattack against med tech firm is 'just the beginning'
Businesses should expect that Iran will conduct more aggressive cyber-ops as the war escalates, according to security analysts.…
M25 live traffic updates as closure expected to continue into evening after serious lorry crash
Britain's bitterest ex: Jilted girlfriend waged campaign lying former partner was paedophile, rapist and drug-addled domestic abuser
Fury at Rachel Reeves' Brexit reversal as she calls for the UK to follow EU rules again
Broken-down train blocks lines between London and Essex
Broken-down train blocks lines between London and Essex
Burberry honours Queen Elizabeth II with new royal-inspired capsule - featuring corgi jewellery and iconic check scarves
Nvidia Announces Vera Rubin Space-1 Chip System For Orbital AI Data Centers
Read more of this story at Slashdot.
New recycling collections to be rolled out in Basildon
Representative Line: Greater Than False
Today's anonymous submitter passes us a single line of JavaScript, and it's a doozy. This line works, but that's through no fault of the developer behind it.
{arr?.length && shouldNotShow === false > 0 (...)}Pedantically, this is JSX, not pure JavaScript, but the rules still apply.
So, fun fact in JavaScript: true > 0 is true, and false > 0 is false. Which generally makes sense, but why would you use that here? But this code is worse than it looks, thanks to operator precedence.
The highest precedence operation is the optional chain- arr?.length. The second highest operation? >. So the first part of the comparison that evaluates is false > 0. Which is false. Do you know what's next? ===. So we compare shouldNotShow to false. Then we && that with the potentially falsy value from our arr?.length.
It's all a mess, and it's all so we can compare against false, which we could have just done with a ! operator. !(arr?.length && shouldNotShow).
Our submitter credits this to an offshore team, and this does have the vibe of throwing characters at the problem until it passes the test. Less LLM-guided and more "manually executed Markov chain". That's also an accurate description of the rest of the code in this code base: hand crafted Markov chain generation.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!