Basic JavaScript - Use Conditional Logic with If Statements

Tell us what’s happening:
I keep getting “trueOrFalse(true) should return the string Yes, that was true”… but it looks like I have written this correctly. Am I missing something?

Your code so far

function trueOrFalse(wasThatTrue) {
  // Only change code below this line

function trueOrFalse(wasThatTrue) {
if (wasThatTrue) 
   return "Yes, that was true";
   return "No, that was false";

  // Only change code above this line

Challenge: Basic JavaScript - Use Conditional Logic with If Statements

Link to the challenge:

You were given the function prototype
Then you added another function inside…

Drop the second line and just make your code work with the first one.

Thanks, but that’s not what I’m having an issue with here

This looks very similar to what I see when someone copies a solution they find somewhere. I recommend against getting in the habit of copying answers. The point is to practice writing code, not the answer itself. Also, it has been my experience that once people start copying answers, they tend to struggle to write their own code on more complex challenges and the certification projects.

That is, in fact, the problem you are having. You incorrectly copied the answer in a way that has multiple syntax errors.

In addition to having two function declarations, you have no closing curly bracket.

I posted here with a genuine question, after trying to figure out what I am doing wrong and rewriting the answers several times. I am very new to coding and I am trying my best to learn. It is extremely disheartening to be accused of copying and cheating.

Why do you have two identical function definitions?

You also need to fix your unbalanced curly brackets. You deleted the } after the last comment.

Honestly, I am not sure why you discounted my suggestion so quickly if you are trying to learn? (My instinct when I saw your response was to move on to the next person and let you go ahead and figure this out alone but Jeremy is actually kinder than he seems because he engaged with you)

Sometimes it helps when learning to listen more…