Great post but two notes:
First => on my personal experience js checks if two objects are the same; I mean if they have the same reference. Like:
Const b = {
value:1
};
Const a = b;
a === b // true
I didn't test that for arrays. And you mentioned that js checks to see if the two thing are equal (in value ? ) sounds to me like js is checking their references. Am I right ?
Second => I think the place of TL;DR should be at the top of this post.
Happy coding.
Hi Ahmad - this is correct! For data structures, it does check to see if the two things being compared point to the same reference in memory - for primitives, it compares the items by value. I'd originally had a bit in the article about reference vs identity, but I chopped it out because it was getting convoluted π³And I think you're right, the TL;DR would be better suited at the beginning. Thanks for your input π
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great post but two notes:
First => on my personal experience js checks if two objects are the same; I mean if they have the same reference. Like:
Const b = {
value:1
};
Const a = b;
a === b // true
I didn't test that for arrays. And you mentioned that js checks to see if the two thing are equal (in value ? ) sounds to me like js is checking their references. Am I right ?
Second => I think the place of TL;DR should be at the top of this post.
Happy coding.
Hi Ahmad - this is correct! For data structures, it does check to see if the two things being compared point to the same reference in memory - for primitives, it compares the items by value. I'd originally had a bit in the article about reference vs identity, but I chopped it out because it was getting convoluted π³And I think you're right, the TL;DR would be better suited at the beginning. Thanks for your input π