DEV Community

Randy Rivera
Randy Rivera

Posted on • Edited on

Using Dot Notation to Access the Properties of an Object

  • The last challenge created an object with various properties. Now you'll see how to access the values of those properties.

  • Here's an example:

let dog = {
  name: "Anakin",
  numLegs: 4
};
console.log(dog.name); // would print the value Anakin
console.log(dog.name); // would print the value 4
Enter fullscreen mode Exit fullscreen mode
  • Dot notation is used on the object name, dog, followed by the name of the property, name, to access the value of Anakin.

Top comments (0)