Any help ? there is debugs and i have no idea how to solve this


#1

var user = prompt ("what kind of food do you like ? fast food or the natural food? or the both ?").toUpperCase();
switch (user) {
case 'natural food':
console.log ("natural food is the healthiest food for your body and brain ");
var tomato= prompt ("do you like tomato? answer with yes or no ).toUpperCase();
if (tomato ==="yes"){
console.log ("tomato contain acid and its good for ur health !");
}
else {
console.log("you should put tomatos in your eat regime!");
}
var hotdogs = prompt ("do you eat hotdog ?answer with yes or no ")
if (hotdogs ==="yes"){
console.log ("that mean your not a vegetarian")
}
else {
console.log ("you are a vegetarian !");
}
if (tomato && hotdogs){
console.log("you adore natural foods , congradulate!");
}

    break;
    case 'fast food':
        console.log ("for me , im not a big fan of fast food");
        break;
        case 'the both':
            console.log("its good to know how to have happiness in eating and keep the good shape !");
            break ;
            default :
            console.log("answer not found , try again ! with fast food , natural food , or , the both ");

}


#2

at the end of line 5.

var tomato= prompt ("do you like tomato? answer with yes or no ).toUpperCase();
                                                              ^
                                            Don't forget the end quotation mark!

Also, you use ',toUpperCase' at the end of your prompts. Your answers have to be in Upper case as well.

if (tomato ==="YES"){

or your could just switch it to '.toLowerCase'


#3

SyntaxError: Unexpected token ILLEGAL
//i've done what you told me to fix but still not working
var user = prompt ("what kind of food do you like ? fast food or the natural food? or the both ?").toUpperCase();
switch (user) {
case 'natural food':
console.log ("natural food is the healthiest food for your body and brain ");
var tomato= prompt ("do you like tomato? answer with yes or no" ).toUpperCase();
if (tomato ==='yes'){
console.log ("tomato contain acid and its good for ur health !)
}
else {
console.log("you should put tomatos in your eat regime!");
}
var hotdogs = prompt ("do you eat hotdog ?answer with yes or no ")
if (hotdogs ==='YES'){
console.log ("that mean your not a vegetarian");
}
else {
console.log ("you are a vegetarian !");
}
if (tomato=='YES' && hotdogs== 'YES'){
console.log("you adore natural foods , congradulate!");
}

    break;
    case 'fast food':
        console.log ("for me , im not a big fan of fast food");
        break;
        case 'the both':
            console.log("its good to know how to have happiness in eating and keep the good shape !");
            break ;
            default :
            console.log("answer not found , try again ! with fast food , natural food , or , the both ");

}


#4
  1. You are using "toUpperCase", so all your conditions must compare the entries with upper case words:

    case 'NATURAL FOOD':
    
    if (tomato ==='YES') {
    
    case 'FAST FOOD':
    
    case 'THE BOTH':

    By the way, you have forgotten to change the "hotdogs" variable to upper case, like this:

    var hotdogs = prompt ("do you eat hotdog ?answer with yes or no ").toUpperCase();
  2. You've also forgotten to write the semicolon and the quotation marks in some places:

    console.log ("tomato contain acid and its good for ur health !");
    
    var hotdogs = prompt ("do you eat hotdog ?answer with yes or no ").toUpperCase();

#5

YEP , INDEED THANK @maxtirdatov