From the course: Introduction to Web APIs

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Retrieve data from an object

Solution: Retrieve data from an object - REST Tutorial

From the course: Introduction to Web APIs

Solution: Retrieve data from an object

(pleasant electronic music) - [Instructor] To access object properties and methods using dot notation, we first need to start by getting the object, so the object here is cat, then dot, and then the property that we want to access is name, so this should get us the cat's name. To get to the owner's name, we have one more level of objects that we need to move through. So we start with cat, but then we need to go into the owner object, so .owner, and then inside of the owner object, we can get the owner name property, so .name. Okay, let's save this and then go back into the browser, and hopefully we should see our message. Back in the browser, let's refresh the page. Great, we see our alert message. Stephanie has a cute cat named Honey Badger. Great job.

Contents