Reputation: 209
Running the following code in Google Chrome I have the switch statement going to default when comparing minus. Why am I encountering this issue? How can I solve it? Thank you all in advance!
var code="F+F−F−F+F"
for(var i = 0; i < code.length; i++) {
alert(code[i]);
switch(code[i]) {
case 'F':
alert("F");
break;
case 'G':
alert("G");
break;
case '+':
alert("+");
break;
case '-':
alert("-");
break;
default:
alert("default");
break;
}
}
Upvotes: 0
Views: 66