The C# language allows you to switch on a string variable . The switch statement compares the String objects in its expression with the expressions associated with each case label as if it were using the String.
Read moreCan Switch case be used for String in JavaScript?
JavaScript has both. In a switch statement, the comparison with the cases is via === , and a string instance is not === to a string primitive. …that will turn it back into a primitive, whereupon your switch works.16 Şub 2013
Read more