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(trueOrFalse){
  return "Yes, that was true";
  } 
  return "No, that was false";

}

but after submit it show // running tests

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

// tests completed

Your browser information:

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

Challenge: Basic JavaScript - Use Conditional Logic with If Statements

Link to the challenge:

You need to use the function parameter

1 Like

Hey ahbi, you are pretty close!

Mod Edit: SOLUTION REMOVED

You want to check whether the argument that is being passed in equates to true or false. The function is the “machine” that does the checking, and the argument is what is being checked. when you call the trueOrFalse() function and pass in false, then it checks whether what is being passed in is true. its false so the first condition doesnt run, leaving the second one to be returned. Note that if(wasThatTrue){.
is the same as if (wasThatTrue === true){.

if it evaluates to truthey or falsey you dont need the explicit '=== true'

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like

Ah OK, I get it, sorry…

Use this code: trueOrFalse(wasThatTrue) {]