Tell us what’s happening:
Describe your issue in detail here.
Question asks to return “Equal”(true ) when “val === 7” but in function parameter it gives “10”. If I am not wrong, it should return false.
**Your code so far**
// Setup
function testStrict(val) {
if (val === 7) { // Change this line
return "Equal";
}
return "Not Equal";
}
testStrict(10);
**Your browser information:**
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Challenge: Comparison with the Strict Equality Operator
I put [spoiler][/spoiler] tags around your code since it is a working solution to the challenge.
Question asks to return “Equal”(true ) when “val === 7” but in function parameter it gives “10”.
Right, for 10, it should return “Not Equal” which it does.
When I test your code, I get the answers I would expect.
console.log(testStrict(10));
// Not Equal
console.log(testStrict('apple'));
// Not Equal
console.log(testStrict(7));
// Equal
console.log(testStrict('7'));
// Not Equal
It returns “Equal” if the parameter is strictly equal to 7 and returns “Not Equal” for everything else.
The phrase “strictly equal to 7”, in JS, means it is equal to 7 and is of data type Number.
If you are still in disagreement, can you give an example that you think should fail or should pass, but doesn’t?
If I pass the number 10 to it, I expect it to return “Not Equal”, because although it is of type Number, it is not equal to 7.