Reputation: 807
I am a little bit confused about this topic for example
var person = "Kobe";
var another = person;
is variable another create an another copy or just reference to person? That being said, if I change person to something else, will another also be changed??
Compare to
var person = {name: "Kobe"};
var another = person;
Thanks for the help
Upvotes: 0
Views: 81
Reputation: 302
Strings (also numbers and booleans) are copied on assignment in JS, object and function share references
Upvotes: 1