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

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

Stral Tech

3 года назад

232 Просмотров

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

Full playlist 👉 https://www.youtube.com/watch?v=xBMb0KylHpI&list=PLH_87_56BLl12l-tU3coWK7Nhm1IMURJz&index=1

"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."

Тэги:

#basic_javascript #learn_javascript #Accessing_Object_Properties_with_Dot_Notation #freeCodeCamp #free_code_camp #stral_tech
Ссылки и html тэги не поддерживаются


Комментарии: