==
and !=
JS-0050 78 return (
79 <div
80 key={idx}
81 ref={idx == posts.length - 1 ? lastPostRef : null} 82 >
83 <Post
84 key={idx}
61 <span
62 key={idx}
63 className={`px-5 text-sm overflow-auto mr-[2vw] py-3 hover:bg-gray-200 hover:cursor-pointer rounded-lg ${
64 channel == c && 'bg-gray-300' 65 }`}
66 onClick={() => setChannel(c)}
67 >
171 <div
172 className="p-4 px-6 hover:bg-gray-200 hover:cursor-pointer mx-auto rounded-2xl my-2 w-[15vw]"
173 style={{
174 backgroundColor: "Questions" == channelName ? "white" : "",175 }}
176 >
177 <p className="text-[30px] lg:text-[calc(10px+0.5vw)] text-center lg:text-left md:text-4xl">
150 <div
151 className="p-4 px-6 hover:bg-gray-200 hover:cursor-pointer mx-auto rounded-2xl my-2 w-[15vw] "
152 style={{
153 backgroundColor: e == channelName ? "white" : "",154 }}
155 >
156 <p className="text-[30px] lg:text-[calc(10px+0.5vw)] text-center lg:text-left md:text-4xl">
128 <div
129 className="p-4 px-6 hover:bg-gray-200 hover:cursor-pointer mx-auto rounded-2xl my-2 w-[15vw] "
130 style={{
131 backgroundColor: "Home" == channelName ? "white" : "",132 }}
133 >
134 <p className="text-[30px] lg:text-[calc(10px+0.5vw)] text-center lg:text-left md:text-4xl">
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