19. math of javascript


#1

Hi people on this part of the code there is some syntax error says missung ) after condotion, and i cant find it please if you can help me. :slight_smile:

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


Stuck on lesson 19. Math of java script
#2

this bit:

"Jon".length 3*2

there is something missing between "Jon".length and 3*2, there needs to be a plus (+) or multiply (*), whatever required by the exercise, and the semi-colon on that line:

if ("Jon".length 3*2 / (2+1) ===2 ); <- this one

is very dangerous, it make the if/else statement not execute properly, remove it


#3

@stetim94 is right, you should have some sort of mathematical sign between "Jon".length and 3*2. And he is also right about the semicolon, it shouldn't be there or else you are going to get a reference error.


#4

I have just looked at the exercise for you, it said to complete the missing bits of code in the if statement to make it equal true, this was the original code that we was given:

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

you answered with this;

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

Looking at what you changed, you have correctly created an if statement, but inside of the bracket for some unknown reason you used ' "Jon".length 3*2 / (2+1) ===2);', in this line of code there is no need for the value of '3', as the command ' "Jon".length ' would already give the value of three, which will then give you a value of '2' after the whole calculation. Try taking out the value of three and it should work.


#5

A post was split to a new topic: 19. What is the right answer please?


#7