From the course: Learning the JavaScript Language

Unlock the full course today

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

Objects, references, and functions

Objects, references, and functions - JavaScript Tutorial

From the course: Learning the JavaScript Language

Objects, references, and functions

- [Instructor] In this video, we're going to talk about objects and functions, how objects are passed by reference into functions, and why we need to pay attention to that fact. To start off, let's look at this object. It's called calvin. And it has this form, a property called name which is Calvin, bestFriend is Hobbes, and it takes the form of a human boy. Along with this object, I have a function I've written which is called the transmogrifier. This function can take a calvin object and transform it into something else. If it sounds like I'm talking absolute nonsense when I say this, I recommend reading the wonderful comic books Calvin and Hobbes by Bill Watterson. It's fun for all ages. Anyhow, let's take a look at how this function works. I'm going to pass in this calvin. And then I'm going to look at the object again. And I can see that Calvin has been transformed from a human boy into a grey wolf. Let's…

Contents