wynd @wynd

answered: arrays cant be checked for equality, thanks oren

does anyone here know why

[typeof "this is a string", typeof "also a string"] == ['string', 'string']

returns false?

Oct 18, 2022, 10:45 PM
8

comments

Reference instead of value equality

If you want to know why arrays can’t be checked for equality, it’s because two objects must be the exact same for == to return true

For example:

[] == [] // false
x = []; x == x // true
["string", "string"] == ['string', 'string'] // false
"s" == 's' // true
['s','a']==['s','a'] //false
['a']==['a'] //false

I guess arrays just cant be checked for equality

oh, good thing i found a different way to find what i was looking for

yeah I looked it up, they cant