philnash ( philnash@programming.dev ) to JavaScript@programming.devEnglish · 3 years agoStop nesting ternaries in JavaScriptwww.sonarsource.comexternal-linkmessage-square25linkfedilinkarrow-up126
arrow-up126external-linkStop nesting ternaries in JavaScriptwww.sonarsource.comphilnash ( philnash@programming.dev ) to JavaScript@programming.devEnglish · 3 years agomessage-square25linkfedilink
minus-squareJakenVeina ( JakenVeina@lemm.ee ) linkfedilinkarrow-up2·3 years 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" };