exerciseFour
JacobJohnson10 (0)

I keep trying to run test for exerciseFour but it fails. It is telling me greaterThanFive is already declared line 51

You are viewing a single comment. View All
vedprad1 (694)

@JacobJohnson10 :
You have a few simple errors.
First of all, you are not supposed to put a semicolon after the if statement.
Second, you should not make a new variable inside the if block, because the variable is already made. Remove the var keyword.
Last but not least, you forgot to close the entire function block with a closing brace.

The final product should like this:

function exerciseFour(value) {
  let greaterThanFive = false;
  if (value > 5) greaterThanFive = true;
  return greaterThanFive;
}

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!

PS: I don't how your teacher grades your assignments, but wouldn't it be easier if you just did this:

function exerciseFour(value) {
  return value > 5;
}