Should return the string No, that was false

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 (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/96.0.4664.93 Safari/537.36

Challenge: Use Conditional Logic with If Statements

Link to the challenge:

You should use the same variable ‘wasThatTrue’ (that is passed as argument in your function) in your ‘if’ statement. Because your function doesn’t know what is ‘trueOrFalse’.


Close - the function does know trueOrFalse, as the function is the variable trueOrFalse. The issue is, because trueOrFalse contains a function, Boolean(function) always returns true.

But you’re absolutely right, the if should be checking wasThatTrue, not trueOrFalse. Great catch!

NOTE: Boolean(myFunction) is not the same as Boolean( myFunction() ). The second says “evaluate the function, take its return value, and coerce that to Boolean”, while the first says “Take the function itself, and coerce that function code and coerce it to Boolean.”

The second will return true or false, depending on the function’s return. The first will always be true.

And doing if(trueOrFalse) is implicitly converting function trueOrFalse(){...} to a Boolean.


I’m sorry, I am very new. I’m going over this for the umpteenth time, in tears, laughing because I have no idea what you’re saying. Every time I read it, little pricks and jabs of information becomes clearer. I learn in a hilarious way! Is there any way you could sublimate the information, I’d greatly appreciate it. I know I’m missing something, just isn’t clicking. I thought I followed the “Help” video tutorial, exactly- but apparently, I haven’t. I’ve moved on to the next to keep my ego in check. I will return to the section and complete it as i move forward. I’m thinking with a few replies and a bit more tutorials, I should be able to figure out what I’m doing wrong. Thank you for taking the time out to reply.

Thank you for taking the time out to reply. I’m going over what you’re saying, attempting to apply.

1 Like

I think I got it! Thank you!

I think I got it, thank you so much!

1 Like

Can you help me out with this…i went back to fix the code…I was moving to fast and now have this screen when attempting to log in…no user account or anything in navbar…what did i do?

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