How do you not make switch statements case-sensitive? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you not make switch statements case-sensitive?

30th Jul 2016, 3:24 PM
Saywer Jones
3 Answers
+ 1
You can format the string before the switch statement. var str = 'String'; str = str.toLowerCase; switch(str):
30th Jul 2016, 7:39 PM
Jeremy Benson
Jeremy Benson - avatar
+ 1
Hi I tested out your codes, it would directly go to default rather than the other cases I've typed in. Why is that?
2nd Aug 2016, 1:46 PM
Saywer Jones
0
i did it wrong. str.toLowerCase()
2nd Aug 2016, 7:12 PM
Jeremy Benson
Jeremy Benson - avatar