37 lines
		
	
	
		
			585 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			585 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | --- | ||
|  | title: Use Dot Notation to Access the Properties of an Object | ||
|  | --- | ||
|  | ## Use Dot Notation to Access the Properties of an Object
 | ||
|  | 
 | ||
|  | ### Method:
 | ||
|  | 
 | ||
|  | The following code will simply print `property1` from the `obj` object. | ||
|  | 
 | ||
|  | ```javascript | ||
|  | 
 | ||
|  | let obj = { | ||
|  |   property1 = 1, | ||
|  |   property2 = 2 | ||
|  | }; | ||
|  | 
 | ||
|  | console.log(obj.property1); | ||
|  | 
 | ||
|  | ``` | ||
|  | 
 | ||
|  | Following this logic, use the `console.log` operation to print both `property1`and `property2`to the screen. | ||
|  | 
 | ||
|  | ### Solution:
 | ||
|  | 
 | ||
|  | ```javascript | ||
|  | 
 | ||
|  | let dog = { | ||
|  |   name: "Spot", | ||
|  |   numLegs: 4 | ||
|  | }; | ||
|  | // Add your code below this line | ||
|  | console.log(dog.name); | ||
|  | console.log(dog.numLegs); | ||
|  | 
 | ||
|  | 
 | ||
|  | ``` |