philnash to JavaScriptEnglish · 1 year agoStop nesting ternaries in JavaScriptwww.sonarsource.comexternal-linkmessage-square34fedilinkarrow-up143arrow-down111
arrow-up132arrow-down1external-linkStop nesting ternaries in JavaScriptwww.sonarsource.comphilnash to JavaScriptEnglish · 1 year agomessage-square34fedilink
minus-squareJakenVeina@lemm.eelinkfedilinkarrow-up2·edit-21 year agoYeah, a switch expression is different than a switch statement. I’m not actually sure how many languages actually have them, but in C# its… var output = input switch { null => "Null", 0 => "Zero", > 0 => "Positive", _ => "Negative" };
Yeah, a switch expression is different than a switch statement. I’m not actually sure how many languages actually have them, but in C# its…
var output = input switch { null => "Null", 0 => "Zero", > 0 => "Positive", _ => "Negative" };