Comparing Array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Comparing Array

why is this bringing FALSE even though they have the same value? let arr0 = [1,2,3,4,5]; let arr1 = [1,2,3,4,5]; let booleany = arr0 === arr1; console.log(booleany);

13th Jul 2020, 4:10 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar
3 Answers
+ 4
You are using strictly equal operator(===) here. It means that both arr0 and arr1 should point at same objects, which they are not hence FALSE.
13th Jul 2020, 4:16 PM
Arsenic
Arsenic - avatar
+ 2
Arsenic i tried using (==) also, but its still printing false
13th Jul 2020, 4:22 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar
+ 2
Rithea Sreng It's really complicated. Thank you.
13th Jul 2020, 4:54 PM
Ibrahim Yusuf
Ibrahim Yusuf - avatar