Built my own code with error "SyntaxError: missing ( before condition" Please help


#1

confirm("Would you like to play a game?");

var travelWant = function (answer){
prompt("Tell me, do you like to ?")
if ("yes"){
    console.log( "Alright then!")
} else {
    console.log ("Find another dang game!")
}};

var userNumber = function (number){
    prompt("Pick 1, 2, or 3 to be assigned a city!");
    if( userNumber < 2){
        console.log("We're going to SF!");
    } if else (userNumber === 2){
        console.log(" Time to get weird in portland!")
    }else{ 
        console.log("Hit the sunny San Deigo!');
    };

Replace this line with your code.

`


#2

here:

console.log("Hit the sunny San Deigo!');

you use a " to mark the start of your string, and a ' to mark the end of your string. That doesn't match. Use either apostrophe or quotation mark


#3

Ah, you beat me to it.

Rest of the code looks ok. I find most of my errors come from simple typos like this, or sometimes failing to fully understand what the lesson wants me to do.


#4

actually, its not the only mistake. if else is used, while this should be else if

and usernumber has no } to close the function


#5

I stand corrected.


#6

Thank you everyone! I should be noticing these things!


#7

Not necessarily, finding and fixing bugs/mistakes is really difficult, you will get better at it over time


#8