Basic JavaScript - Use Conditional Logic with If Statements

any help would be appreciated

function trueOrFalse(wasThatTrue) {
// Only change code below this line
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/97.0.4692.99 Safari/537.36

Challenge: Basic JavaScript - Use Conditional Logic with If Statements

Link to the challenge:

I don’t see an if statement anywhere in your code? The challenge talks about if statements, so you probably need to use one.

lol thanks im new new new fresh off the boat new. 35 hurt my back doing concrete work so i decided to give this a shot

any help is much appreciated
what is an if statement

Did you miss this text:

if statements are used to make decisions in code. The keyword if tells JavaScript to execute the code in the curly braces under certain conditions, defined in the parentheses. These conditions are known as Boolean conditions and they may only be true or false.

When the condition evaluates to true, the program executes the statement inside the curly braces. When the Boolean condition evaluates to false, the statement inside the curly braces will not execute.

Pseudocode

if (condition is true) {
statement is executed
}

im lost on this one
ive watched the video and still dont get it

I said “You need an if statement”

You said “what is an if statement”

At the very least, if you have read the lesson and watched the video, you should be able to identify which part of the code is the “if statement”. Its the thing that says ‘if’.

Do you see the keyword if anywhere in your code? You need to use if since this lesson is about if.

i understand your statement. im a noob just need a better example is all.
i appreciate your help and time

i just started yesterday with no coding knowledge or computer skills so bare with me please

I’m trying to understand what you do and do not understand. Me rewriting the entire lesson for you could end up doing nothing to help you if I don’t understand what you do and don’t know.

You might be moving too fast if you covered this much material in 1 day.

In this challenge, there is an example with a function called test. Can you find that example? Where is it?

Inside of that example, the if keyword is used. Can you identify the lines that use the if keyword and the if statement?

i dont understand how to write the code basically

Did you read everything I posted?

yes i did have to post 20 characters

Ok…

so…

Can you tell me what part of the example code has the function called test?

Can you tell me which lines of code in the example use the if keyword?

Go ahead and copy over those line from the example and show them to me.

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



  // Only change code above this line
function test (myCondition) {
  if (myCondition) {
    return "It was true";
  }
  return "It was false";
}

test(true);
test(false);

can’t i use this example then insert the words.

Right, but that isn’t what you have done.

no but i should be able to do that correct

You should be able to, yes. If you understand the example code.

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

test(true);
test(false);


  // Only change code above this line

}