Tell us what’s happening:
Okay, so I got this to work. It was easy. Stupidly easy BUT, apparently I’m stupid for not knowing WHY it works. And if I move on without someone explaining to me why the hell this works I may go nuts.
So, walking through this. I declared a function gave it a parameter. Then if my parameter is true i get the first return, if false i get the second. Seems simple enough. But where does our function ever tell the thing to check if it is true. All i’m efdectively doing when i run it is giving my parameter a value of either true or false, so i should just be getting back my first line. Computer should see it be like yup, it’s got a value, return his first line.
Shouldn’t it be more like this?
function trueOrFalse(wasThatTrue) {
if (wasThatTrue = true) {
return "Yes, that was true";
}
return "No, that was false";
}
What is my function comparing the argument to in order to give me either return? If I go with the answer they want it doesn’t make sense. What am i missing?
Your code so far
// Example
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return "Yes, it's true";
}
return "No, it's false";
}
// Setupo
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.
// Change this value to test
trueOrFalse(true);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Linux; Android 7.0; SM-G955U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.123 Mobile Safari/537.36.
Link to the challenge:
https://www.freecodecamp.org/challenges/use-conditional-logic-with-if-statements
