SyntaxError: expected expression, got ')'


#1

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

Not sure whats wrong

Hint

There is a lot of left out syntax. The if keyword and the { } after the else keyword are all left out.

Make sure not to delete any of the provided code. It could cause your code to fail!

I was thinking it has somthing to do with the sum but it says not to delete any of the code and I dont see the problem anyway, It could be to do with the browser im using 'Firefox' as ive had problems before with it so ill try using another browser and let you know if it works.


#2

This exercise works in Firefox for me.

When it says "not to delete any of the provided code" it means none of the existing code needs to be altered. All your modifications should come as additions to the script.


#3

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

Solved it, I thought when it was run it would solve the sum itself and not require me to do the sum.
Eg: "Jane".length+5
//when its run it solves the sum itself giving the answer 9 so why do I have to solve the above sum?


#4

The purpose of a conditional operator (===, >, etc) is to compare two things. So something like:

5 >

will result in an error. It needs something on each side in order to evaluate to either true or false.

.length is a property of a string and its purpose is to return the length of the string.


#5

Yeah that makes sense, Thanks for your help I really appreciate you taking time to help me out.