Tell us what’s happening:
Describe your issue in detail here.
My error says that my 'wasThatTrue; function doesn’t return correctly when the argument is false.
function trueOrFalse(wasThatTrue) {
// Only change code below this line
if (wasThatTrue = true) {
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/116.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Use Conditional Logic with If Statements
== and === are both used for comparison but they behave differently eg:
== is used to check equality of values after performing type coercion if the operands have diiferent types.
Type coercion means javascript will attempt to convert one or both operands to a common type before making the comparison.
If the values are of different types, JavaScript will try to convert them to a common type and then compare them.
eg: 1 == '1'; // true true == 1; // true
will return true because JavaScript converts the string '1' to the number 1 before comparing them.
=== (Strict Equality Operator):
The other ones is called the Strict Equality Operator
=== operator, checks for both value and type equality.
It does not perform type coercion, so if the operands have different types, it returns false .
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.