Plz need help on 19 explain the answer in detail


#1

("Jon".length * 2 / (2+1) === 3)
if{
console.log("The answer makes sense!");
}
else{
console.log("Error Error Error");
}


#2

what is the answer to this please explain in detail?


#3

You have some pieces in the wrong order here.

You want the condition to come after if.

Proper syntax of an if statement should look like this:

if (condition) {
    // Do this
} else {
    // Do this
}

The // Do this is just a comment that will be ignored. This is where you will place console.log(); or whatever else you'd like it to do.


#4

Thank you for the help


#6

its didnt work for me could you help this is what i have put
("Jon".length * 2 / (2+1) === 3)
if{
console.log("The answer makes sense!");
}
else{
console.log("Error Error Error");
}
if ('condition') {
// Do this
} else {
// Do this


#7

comment out

and

and try again


#8

nope nothing happened all i got was "There was a problem with your syntax."


#10

it should be

("Jon".length * 2 / (2+1) === 2)

3*2/3 === 2


#11

ok then what after that


#12

why dont you show me what you put


#13

set it all up like this


#14

it says It looks like 'condition' on line 9 was not defined before it was used. This means either you need to define it, 'condition' is spelled incorrectly or you need quotes around 'condition'.


#17

@hleighton

spilled the beans! :slightly_smiling:

I believe it is against the forum guidelines to give full/direct answers you have to delete it (later).


#18

do a full browser refresh.
delete everything that you have in the editor and copy/paste @hleighton answer


#19

Oops! I couldn't think of any other explanation. I removed it. Thanks for the heads up, I should better familiarize myself with the guidelines.


#20

Sorry I forgot aswell that people weren't allowed to give out the answers