==
and !=
JS-0050128 <div className="flex items-center justify-center space-x-2">
129 <div
130 className={`m-1 h-2 w-2 animate-ping rounded-full ${
131 moderator.status == 1132 ? "bg-orange-400"
133 : moderator.status == 2
134 ? "bg-green-400"
136 } `}
137 />
138 <p className="text-gray-200">
139 {moderator.status == 1140 ? "Pending"
141 : moderator.status == 2
142 ? "Accepted"
138 <p className="text-gray-200">
139 {moderator.status == 1
140 ? "Pending"
141 : moderator.status == 2142 ? "Accepted"
143 : "Rejected"}
144 </p>
130 className={`m-1 h-2 w-2 animate-ping rounded-full ${
131 moderator.status == 1
132 ? "bg-orange-400"
133 : moderator.status == 2134 ? "bg-green-400"
135 : "bg-red-400"
136 } `}
199 <p className="flex items-end text-2xl text-gray-200">
200 {userIsRegistered.status == 1
201 ? "Pending"
202 : userIsRegistered.status == 2203 ? "Accepted"
204 : "Rejected"}
205 </p>
It is considered good practice to use the type-safe equality operators ===
and !==
instead of their regular counterparts ==
and !=
.
The strict equality operators (===
and !==
) use the strict equality comparison algorithm to compare two operands.
false
.true
only if they refer to the same object.null
or both operands are undefined
, return true
.NaN
, return false
.+0
and -0
are considered to be the same value.true
or both false
.The most notable difference between this operator and the equality (==
) operator is that if the operands are of different types, the ==
operator attempts to convert them to the same type before comparing.
a == b
foo == true
bananas != 1
value == undefined
typeof foo == 'undefined'
'hello' != 'world'
0 == 0
true == true
foo == null
a === b
foo === true
bananas !== 1
value === undefined
typeof foo === 'undefined'
'hello' !== 'world'
0 === 0
true === true
foo === null