+ 1

"!==" what does it mean?

so I am having a hard time what this means: return ( number % 2 !== 0); mostly with the" !==". does it function the same way as "=" and "=="? so for example: (number % 2 !== 0) console.log(2); so would it be ( 2 % 2 !==0) the output should be 0. I am a bit confused, please help! thank you.

20th Mar 2023, 1:47 AM
Eren
5 Answers
+ 4
In JavaScript, the "!=="" operator is used for strict inequality comparison, which means that it compares two values and returns a Boolean value based on whether they are not equal in value or data type. In the context of the code you provided, "(number % 2 !== 0)" means that it checks whether the remainder of the division of "number" by 2 is not equal to zero. If the remainder is not equal to zero, then it returns true; otherwise, it returns false.
20th Mar 2023, 1:54 AM
Minh Lưu
Minh Lưu - avatar
20th Mar 2023, 4:53 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 1
In python it is similar Operator Meaning Example ==Is Equal To 3 == 5 gives us False !=Not Equal To 3 != 5 gives us True
20th Mar 2023, 2:54 AM
Herobrine
Herobrine - avatar
0
Eren It is used for inequality comparison ....
21st Mar 2023, 3:34 PM
Abhishek