Basic Javascript (82/111) | Accessing Object Properties with Dot Notation | freeCodeCamp

Published: 09 November 2020
on channel: Stral Tech
236
2

Basic Javascript (82/111) | Accessing Object Properties with Dot Notation | freeCodeCamp

Full playlist 👉    • Basic JavaScript (1/111) | Comment Yo...  

"There are two ways to access the properties of an object: dot notation (.) and bracket notation ([]), similar to an array.

Dot notation is what you use when you know the name of the property you're trying to access ahead of time.

Here is a sample of using dot notation (.) to read an object's property:

var myObj = {
prop1: ""val1"",
prop2: ""val2""
};
var prop1val = myObj.prop1; // val1
var prop2val = myObj.prop2; // val2
Read in the property values of testObj using dot notation. Set the variable hatValue equal to the object's property hat and set the variable shirtValue equal to the object's property shirt."


Watch video Basic Javascript (82/111) | Accessing Object Properties with Dot Notation | freeCodeCamp online without registration, duration hours minute second in high quality. This video was added by user Stral Tech 09 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 236 once and liked it 2 people.