Tell us what’s happening:
Describe your issue in detail here.
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Comparison with the Strict Equality Operator
Link to the challenge:
Why is this function where ever I am writing it, it is showing only the next return value = “Not Equal”. It’s not working I think.
When ever I am console.log the function it’s answer is the same … Not Equal. Why is that? I don’t understand … May be I don’t get what it’s trying to teach…
Change the ‘val’ to be 7 in the testStrict() function call and print it in the console. You will get “Equal”.
The given val in the testStrict() is an example of the case when you get “Not Equal”:
1 Like
I have completed the test alright… But isn’t it suppose to work if like the video tutorial in any other text editor and the dev tool…
It’s only returning the red marked value… if I change the second return’s value, console.log’s value is changed to the second returns value only. Even if I put the else if condition it’s doing the same.
If you apply console.log() method on the function with the number 7 you will get at the output “Equal”.
1 Like
Thank you sir. Now I got what I wanted. Thank you.
1 Like
system
Closed
February 17, 2024, 12:28am
9
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.