Equality of Arrays: JavaScript Challenge | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Equality of Arrays: JavaScript Challenge

/* My challenger and I both answered this one wrong. My understanding is that == means equality, not assignment and not duplication. So why is the answer false, true? */ What is the output? var arr1= [1,2,3]; var arr2= [1,2,3]; var arr3= arr1; console.log(arr1==arr2); console.log(arr1==arr3);

22nd Mar 2022, 1:52 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar
2 Réponses
+ 1
Tahiti🌍Castillo Reference matters The references of arr1 and arr2 are not same But references of arr3 and arr1 are same because you have given reference of arr1 to arr3
22nd Mar 2022, 1:56 AM
A͢J
A͢J - avatar
0
A͢J thank you. JavaScript can be so confusing sometimes.
22nd Mar 2022, 2:17 AM
Tahiti🌍Castillo
Tahiti🌍Castillo - avatar