Using string in switch case

How can string be used in switch case to get led blink by giving input of their color name

I don’t want to use char a ,b ,c n all

which language are you talking about? javascript?

Strings can’t be used in switch case but you can use if, else if, else

var str = "test";
if (str === "test") { console.log("is test"); }
else if (str == "notPossible") { console.log("not possible"); }
else { console.log("unknown case"); }

Ya …i checked it on Google , it canbe done on latest java update but not in other programming languages , yes I was asking for JavaScript , anyhow I had to use numbers …

you can be creative to get switch case like functionality though.