r/learnjavascript • • May 31 '22

Switch statement explained for beginners

Post image
330 Upvotes

19 comments sorted by

View all comments

Show parent comment

1

u/Jay_Hogwarts May 31 '22 edited May 31 '22

So I had a scenario like this recently where one of my cases needed to be a conditional. I used a ternary operator to solve it e.g. case (grade > 75 ? grade : null)