Been looking for something where I could test if a variable has a certain word with switch statement:
JavaScript
var str = "We are VR Troopers";
switch (str) {
case str.includes("are"):
// do something;
break;
// no default
}
I have looked here and found nothing. Can you provide a link with your answers? That's a plus for my learning. Thanks.
I want to limit the use if too many if
's.