Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question 31 #79

Open
Enzaik opened this issue Sep 9, 2019 · 3 comments
Open

Question 31 #79

Enzaik opened this issue Sep 9, 2019 · 3 comments

Comments

@Enzaik
Copy link

Enzaik commented Sep 9, 2019

Both compares return false. This is because in JavaScript we pass non primitive data types by reference. So, say:
{id:1} == {id:1} // returns false even though is shallow compare, we are not comparing here two objects values, but 2 references, which are different.

@ganqqwerty
Copy link
Owner

ganqqwerty commented Sep 25, 2019

you are totally right, this question is misleading. Will remove it.

@Enzaik
Copy link
Author

Enzaik commented Sep 25, 2019

Anyway, the guide is very good 😊 congrats!

@akashpjames
Copy link

@ganqqwerty I came here to create this issue but found there is already a ticket for it. Is this question relevant? Because if we need to shallow copy, can't we just assign it?
Eg:
var object1 = {a: 1}; var object2 = object1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants