Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

660 B

title
title
Use Dot Notation to Access the Properties of an Object

Use Dot Notation to Access the Properties of an Object


Problem Explanation

The following code will simply print 1 from the obj object.

let obj = {
  property1: 1,
  property2: 2
};

console.log(obj.property1);

Following this logic, use the console.log operation to print both property1and property2to the screen.


Solutions

Solution 1 (Click to Show/Hide)
let dog = {
  name: "Spot",
  numLegs: 4
};
// Add your code below this line
console.log(dog.name);
console.log(dog.numLegs);