Please help me, i am stuck


#1

Why it's wrong, please help me, thank u so much !

var user=prompt("danh nhau ko?").toUpperCase();
switch(user) {
case 'co':
var khoe=prompt("may khoe chu ?").toUpperCase();
var khon=prompt("may khon chu ?").toUpperCase();
if (khoe==='YES'||khon='YES'){
console.log("may se thang!");
}
else {
console.log("may dut!");
}
break;
case 'deo choi':
console.log("so a!");
break;
case 'chien luon':
console.log("thang nay mau!");
break;
case 'em xin anh a':
console.log("thang nhan gan!");
break;
default:
console.log("nhu khi!");
}


#2

Hello @tuebmcc00532xfunix.e,

Can you attach a link to course you are on? Thanks!


#4

I believe it may be something to do with the fact that you haven't included the keyword break in your default case. Try adding that in...


#5

If you feel I have helped you, mark my answer as solution. Keep coding hard :smile:!


#6

is it possibe for case to contain more values? like for ex:

case "i m good"||"almost good":
do something here


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.