Logical Operators Help


#1




I used a video from Youtube for help with this code so the code isn't mine. Im getting the green light but it is only asking me if im looking for a job, instead of asking if I have marketable skills like in the video when I say yes, it always goes to the default and wont ask the other questions. How do I get it to go through and ask me the other questions? Uhhhg.


Replace this line with your code. 
var user= prompt("Are you looking to get a job?").toLowerCase();

switch (user) {
    case 'Yes':
        var answer = prompt ("Do you have any marketable skills?").toLowerCase();
        if (answer== 'Yes'){
            answer= true;
            var choice= false; 
            console.log("You may be just right for this job."); 
            if (answer== true && choice== false){
        var deal= prompt("Is there anything we can do to make you take the job?").toLowerCase();
        if (deal == 'Yes') {
            deal= true; }
        if (deal== true || answer==true){
           console.log("Thank you for taking the job.");
        }else{ 
            console.log("Sorry to hear that, best of luck to you.");
        }
        }
        }
            if (answer== "no"){
                answer= false;
                console.log("Sorry to hear that");}
        break;
        case 'no': 
            console.log("Have a good day then.");
            break;
            case 'maybe':
                console.log("We don't hire maybes.");
                break;
                default:
                console.log("Did you understand the question?");
}


#2

here:

var user= prompt("Are you looking to get a job?").toLowerCase();

you convert the user input to lowercase, so then when i enter YES it gets converted to yes. good so then this is the case:

case 'Yes':

this is case sensitive, yes == Yes is false. Make Yes into yes, then it should work


#3

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