trueOrFalse trouble

Managed to correct this myself
challenge won’t pass as

trueOrFalse(false) should return the string No, that was false

don’t understand what i’m doing wrong - sorry

  **Your code so far**

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

// 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/92.0.4515.131 Safari/537.36

Challenge: Use Conditional Logic with If Statements

Link to the challenge:

This line:

if (trueOrFalse) {

trueOrFalse is the name of the function, and since that function isn’t null, undefined, literally false or some other falsy value, the if statement will always evaluate to true.

You probably want to put a different variable in there.

1 Like

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