+ 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.
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.
+ 3
https://stackoverflow.com/questions/42517721/difference-between-and#:~:text=on%20this%20post.-,!%3D,being%20compared%20to%20each%20other.
+ 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
0
Eren It is used for inequality comparison ....