Doubt in Array and strings about the references

When we compare 2 different arrays even with the same value its false. and i get it, it is because they have different references but with strings if i create 2 different variables and add the same value they are equal even with strict comparison === so is that means string don't have references?
No description
2 Replies
Israr
Israr11mo ago
like here i created 2 string with my name with different variable but they are true when compared but if i put the same value in array it's not the same for Javascript
Rägnar O'ock
Rägnar O'ock11mo ago
Everything in JS is compared by value, the difference between a string (or number) and an array (or any non primitive type) is that the 2 array, whatever their content might be, cannot have the same value The == or === here don't change anything, the first would make a type casting before comparing 2 values of differing types (a string and a number for example) and the other wouldn't, but that has nothing to do with the "incomparability" of non primitive types It's one of the quirk of js
Want results from more Discord servers?
Add your server