0

var a=[12,26,"pawan",77]; var b=[12,26,"pawan",77];

Why a==b is not equal ?

20th May 2021, 2:07 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar
3 Respuestas
0
because a and b hold two different objects, even if their items values are equals ^^
20th May 2021, 2:15 PM
visph
visph - avatar
+ 4
Variables, a and b each contain only a reference to a location in memory. Not the value of the object. The locations are separate, so the references are different, and the comparison return false.
20th May 2021, 2:34 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar
- 1
Oo I think
20th May 2021, 2:28 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar