Expected '!==' and instead saw '!='
80 <a
81 className={`side-nav-btn mt-4 ${
82 router.pathname == Routes.PartnerWithUs &&
83 HoverLinkRef != 5 && 84 'active'
85 }`}
86 href="partnerwithus"
Expected '===' and instead saw '=='
79 <Link href={Routes.PartnerWithUs} passHref>
80 <a
81 className={`side-nav-btn mt-4 ${
82 router.pathname == Routes.PartnerWithUs && 83 HoverLinkRef != 5 &&
84 'active'
85 }`}
Expected '!==' and instead saw '!='
66 <a
67 className={`side-nav-btn mt-4 ${
68 router.pathname == Routes.GiveYourTime &&
69 HoverLinkRef != 4 && 70 'active'
71 }`}
72 href="giveyourtime"
Expected '===' and instead saw '=='
65 <Link href={Routes.GiveYourTime} passHref>
66 <a
67 className={`side-nav-btn mt-4 ${
68 router.pathname == Routes.GiveYourTime && 69 HoverLinkRef != 4 &&
70 'active'
71 }`}
Expected '!==' and instead saw '!='
53 <Link href={Routes.Fund} passHref>
54 <a
55 className={`side-nav-btn mt-4 ${
56 router.pathname == Routes.Fund && HoverLinkRef != 3 && 'active' 57 }`}
58 href="fund"
59 onMouseEnter={() => setHoverLinkRef(3)}
Expected '===' and instead saw '=='
53 <Link href={Routes.Fund} passHref>
54 <a
55 className={`side-nav-btn mt-4 ${
56 router.pathname == Routes.Fund && HoverLinkRef != 3 && 'active' 57 }`}
58 href="fund"
59 onMouseEnter={() => setHoverLinkRef(3)}
Expected '!==' and instead saw '!='
40 <a
41 className={`side-nav-btn mt-4 ${
42 router.pathname == Routes.InKind &&
43 HoverLinkRef != 2 && 44 'active'
45 }`}
46 href="inkind"
Expected '===' and instead saw '=='
39 <Link href={Routes.InKind} passHref>
40 <a
41 className={`side-nav-btn mt-4 ${
42 router.pathname == Routes.InKind && 43 HoverLinkRef != 2 &&
44 'active'
45 }`}
Expected '!==' and instead saw '!='
27 <Link href="/" passHref>
28 <a
29 className={`side-nav-btn mt-4 ${
30 router.pathname == '/' && HoverLinkRef != 1 && 'active' 31 }`}
32 href="home"
33 onMouseEnter={() => setHoverLinkRef(1)}
Expected '===' and instead saw '=='
27 <Link href="/" passHref>
28 <a
29 className={`side-nav-btn mt-4 ${
30 router.pathname == '/' && HoverLinkRef != 1 && 'active' 31 }`}
32 href="home"
33 onMouseEnter={() => setHoverLinkRef(1)}
Expected '===' and instead saw '=='
114 <Link href={Routes.PartnerWithUs} passHref>
115 <a
116 className={`p-3 hover:bg-gray-700 rounded ${
117 router.pathname == Routes.PartnerWithUs && 'active'118 }`}
119 href="partnerwithus"
120 >
Expected '===' and instead saw '=='
104 <Link href={Routes.GiveYourTime} passHref>
105 <a
106 className={`p-3 hover:bg-gray-700 rounded ${
107 router.pathname == Routes.GiveYourTime && 'active'108 }`}
109 href="giveyourtime"
110 >
Expected '===' and instead saw '=='
94 <Link href={Routes.Fund} passHref>
95 <a
96 className={`p-3 hover:bg-gray-700 rounded ${
97 router.pathname == Routes.Fund && 'active' 98 }`}
99 href="fund"
100 >
Expected '===' and instead saw '=='
84 <Link href={Routes.InKind} passHref>
85 <a
86 className={`p-3 hover:bg-gray-700 rounded ${
87 router.pathname == Routes.InKind && 'active' 88 }`}
89 href="inkind"
90 >
Expected '===' and instead saw '=='
74 <Link href={Routes.Home} passHref>
75 <a
76 className={`p-3 hover:bg-gray-700 rounded ${
77 router.pathname == '/' && 'active' 78 }`}
79 href="home"
80 >
Description
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.
- If the operands are of different types, return
false
. - If both operands are objects, return
true
only if they refer to the same object. - If both operands are
null
or both operands areundefined
, returntrue
. - If either operand is
NaN
, returnfalse
. - Otherwise, compare the two operand's values:
- Numbers must have the same numeric values.
+0
and-0
are considered to be the same value. - Strings must have the same characters in the same order.
- Booleans must be both
true
or bothfalse
.
- Numbers must have the same numeric values.
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.
Bad Practice
a == b
foo == true
bananas != 1
value == undefined
typeof foo == 'undefined'
'hello' != 'world'
0 == 0
true == true
foo == null
Recommended
a === b
foo === true
bananas !== 1
value === undefined
typeof foo === 'undefined'
'hello' !== 'world'
0 === 0
true === true
foo === null