JAVASCRIPT · ОСНОВЫ · LESSON 12

List of numbers

Massive · about 12 minutes

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

One box for many

The array stores several values. Its boundaries are square brackets and the values are separated by commas.

const scores = [2, 4, 6];
Massif locations
0first1second2third

✦ scores has three numbers.

STEP 2

Find out the length.

The length property tells you how many elements are inside an array.

const scores = [2, 4, 6];
console.log(scores.length);

✦ That's 3.

IN-CLASS PRACTICE

Type the code yourself

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

const numbers = [1, 3, 5];
console.log(numbers.length);
Open the editor for class work
HOMEWORK

Solve it yourself

Create const nums as an array of 2, 4, 6, 8. Indicate its length through length.

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

Opening up your homework