1. We've come a long, long


#1

Hi guys, can i have you to check if there is anything i'm missing? It's a Syntax Error again...:

SyntaxError: Unexpected token '{'. Expected ')' to end a 'if' condition.


var answer = true;

var answer = function() {
    if (3*90 === 270) {
        console.log(answer);
    } else if (!(false && (!false)) {
        console.log(answer);
    } else ("bex".toUpperCase() === "BEX") {
        console.log(answer);
    };
};


#2

your else if condition has three opening parentheses versus two closing parentheses. with other words, a ) is missing


#3

ok... still Syntax Error with the similar message:

SyntaxError: Unexpected token '{'. Parse error.

I don't see any errors... :sweat:

so i can only use the default code with this answer to pass the next one:

var answer = (((3 * 90) === 270) || !(false && (!false)) || "bex".toUpperCase() === "BEX");

quite disappointed though... but thank you.


#4

we should be able to get your code to work, can you post an updated version of your code?


#5

ok, much appreciated.. here it is:

var answer = true;

var answer = function() {
    if (3*90 === 270) {
        console.log(answer);
    } else if (!(false && (!false))) {
        console.log(answer);
    } else ("bex".toUpperCase() === "BEX") {
        console.log(answer);
    };
}

#6

lets look at the instructions:
Declare a variable named answer. Assign to it the Boolean value that the expression evaluates to. Delete the default code in the editor and run your code.

so basically what you got to do is check the logic of the expression, see if it evaluates to true or false. then create a variable answer and set it to the outcome:

answer = true;

Then delete the expression, so you only have answer = true in your editor

I like your thinking, simply set answer to the outcome of the expression.

as for the syntax error you have, else can't have a condition since it is everything else:

else { console.log(answer);}

see? no condition for else


#7

stetim, thanks for your teaching, it worked out, the console print out the statement in true.

so... i just need to practice it more, i'm putting another if/else statement, for the uppercase letters of "bex". and yes, the else shouldn't be with any condition, here is my update:

answer = true;

if (3*90 === 270) {
console.log(answer);
} else if ((!false) && (!false)) {
console.log(answer);
} else {
console.log(answer);
}

if ("bex".toUpperCase() === "BEX") {
console.log(answer);
} else {
console.log(answer);
}

or next, i would like to try turning the answer = false; after the else {}
will try it soon. now dinner. brb.


#8

this is a simple exercises, it requires one line of code to solve it, i assume you managed that.

Use markup for your code:

makes it so much easier to read it


#9

Thank you so much @stetim94 ! Yes you have solved my problem,

you may mark me off :slight_smile:


#10