JAVASCRIPT · ОСНОВЫ · LESSON 18

Item with properties

Object · about 12 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

The signature thing.

The object stores values under property names. Its boundaries are brackets.

const cat = { name: "Рыжик", age: 2 };

✦ The cat has a name and an age.

STEP 2

Read through the dot.

After the object name, put a point and a property name.

const cat = { name: "Рыжик", age: 2 };
console.log(cat.name);

✦ Redhead will appear.

IN-CLASS PRACTICE

Type the code yourself

Type an example manually. Check the names, brackets and signs.

const dog = { name: "Бим", age: 3 };
console.log(dog.name);
Open the editor for class work
HOMEWORK

Solve it yourself

Create const pet as an object with the properties of name: «Кот» and age:4. Take out pet.age.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework