Basic JavaScript - Use Conditional Logic with If Statements

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function trueOrFalse(wasThatTrue) {
  // Only change code below this line
  if (wasThatTrue= false){
    return "No, that was false";
  }
    return "Yes, that was true";

  // Only change code above this line

}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Use Conditional Logic with If Statements

Link to the challenge:

:balloon: Hi, welcome to the forum!
We see you have posted some code but did you have a question?

The problem is that you used = (the assignment operator) instead of === or == (condition verifiers).
The assignment operator is used when declaring variables not to check for similarity in conditionals, in conditionals you use the condition verifiers.

Here you didnt add the closing curly bracket, though i reccomend you use else instead.

So if you apply all that i have said, your code should look like this:

function trueOrFalse(wasThatTrue) {
  // Only change code below this line
  if (wasThatTrue === false){
    return "No, that was false";
  } else {
        return "Yes, that was true";
  }
          
  // Only change code above this line

}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.