Tell us what’s happening:
Please, could someone check my response to point out to why my code failed?
Create an if
statement inside the function to return "Yes, that was true"
if the parameter wasThatTrue
is true
and return "No, that was false"
otherwise.
Passed
trueOrFalse
should be a function
trueOrFalse(true)
should return a string
trueOrFalse(false)
should return a string
trueOrFalse(true)
should return “Yes, that was true”
trueOrFalse(false)
should return “No, that was false”
Your code so far
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return "Yes, it's true";
}
return "No, it's false";
}
// Setup
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.
}
// Change this value to test
trueOrFalse(true);
```js
// Example
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return "Yes, it's true";
}
return "No, it's false";
}
// Setup
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.
}
// Change this value to test
trueOrFalse(true);
**Your browser information:**
User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0`.
**Link to the challenge:**
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements