Logical operators


*So my code works just wondering why when i put an answer in it still prints out the default*

var user = prompt("What's you're favorite hobby?").toUpperCase();

switch(user) {
    case 'Surfing':
        console.log("Hang loose bruddah!");
    case 'Hiking':
        var Hiking = prompt("Would you like to go Hiking with me?, (Yes or No)").toUpperCase();
        var Place  = prompt(" Would you like to go hiking at Havasu Falls?, (Yes or No)").toUpperCase();
        if(Hiking === 'yes' && Place === 'yes') {
            console.log("Let's go!");
        } else {
            console.log("Maybe another time");
    case 'Traveling':
        var Hawaii = prompt("You eva been Hawaii? (Yes or No)").toUpperCase();
        var bumbai = prompt("You like go? (Yes or No)").toUpperCase();
        if(Hawaii === 'yes' || bumbai === 'yes') {
            console.log("Cheehu we go!");
        } else {
            console.log("Shoots den");
        console.log("Oh very nice");


You convert the user input to uppercase.

var str = "Hello World!";
var res = str.toUpperCase();

The code above will result in HELLO WORLD!.
I think you know what to do from here.


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