Can anyone tell me what wrong?


this code passes,but every time it posts the default answer


Your question is a little vague... what is your code?


It does same thing for me! Any switch case, the answer I get is default. It works if I take the .toUpperCase () away :confused:

Part of my code (took out the remaining switches):

var user = prompt("What meal would you like for dinner?").toUpperCase();

switch(user) {
case 'Indian':
var t = prompt("Do you have turmeric?").toUpperCase();
var g = prompt("Do you have ginger?").toUpperCase();
if ( t === 'yes' || g === 'yes') {
console.log("OK, not great but you can still cook with one spice!");
else if ( t === 'yes' && g === 'yes') {
console.log("Great, both spices will make it perfect!");
else {
console.log("Sorry that won't make an Indian meal!");

case 'Chinese':
case 'Thai':



You have one little problem there. In your code, where there's

t === 'yes' || g === 'yes'


t === 'yes' && g === 'yes'

you put the "yes" into lower case. The reason that it does not work is that the code takes the answer to upper case, which can not work with the codes because you made it lower case. You can correct this by either changing all the




this will most likely get your problem solved. You can also change all the "yes"'s to upper case, but it takes longer than just changing the to.UpperCase(); to to.LowerCase();.

Hope it helped!:smiley:


Awww you're a genius! Yes it indeed works now. :smiley: Thanks!