Can someone help me fix this?

Tell us what’s happening:
Describe your issue in detail here.
why is this not working, im so confused. please help me

  **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/99.0.4844.84 Safari/537.36 OPR/85.0.4341.72

Challenge: Use Conditional Logic with If Statements

Link to the challenge:

this argument (wasThatTrue = false) sets wasThatTrue value to false
it doesn’t check if the value itself is false.

more info about Equality comparisons
Equality comparisons and sameness - JavaScript | MDN (mozilla.org)

oh for more info.

when you use a single equal sign you aren’t using the argument in trueOrFalse(wasThatTrue), so looking at your code.

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

although both of them having the same name they aren’t the same object

1 Like

You are assigning value rather than checking. if (wasThatTrue = false)

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