From the course: Learning the JavaScript Language

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Jargon: References

Jargon: References

- [Instructor] When working with JavaScript objects, there's an important concept called references. Objects are references to particular locations in the computer's memory and that impacts your ability to work with them in different contexts. So let's create an animal object one more time and check its value. I'm going to copy everything from the start of this file into Node, and now when I check the value, I can see everything looks right. Now I'm going to create another variable called animal2 and assign animal to it. If I inspect animal2, it's all the same stuff. Now the question here is, what have I actually done when I executed that assignment statement? Did I make a copy of the animal object? As we will see the answer turns out to be no. To demonstrate this, let's change animal2's genus to ursus, a bear. So now when I inspect animal2, I see that the genus has been set to ursus, which is what I expect, but if I…

Contents