Video Lesson

Lesson Notes

Understanding Arrays in JavaScript

Arrays in JavaScript are lists that can hold any type of value, including strings, numbers, booleans, symbols, undefined, null, objects, and even other arrays.

Creating an Array

Declare an array using square brackets:

1const myList = [ 2 "Hello world", 3 12, 4 43, 5 true, 6 undefined, 7 null, 8 Symbol("id"), 9]; 10console.log(myList);

Nested Arrays

Arrays can contain other arrays, creating deeply nested structures:

1const complexList = [ 2 [70, 66, 74.23], 3 { name: "Alice" }, 4 [ 5 ["foo", "bar"], 6 33, 7 ], 8]; 9console.log(complexList);

Key Points

  • Arrays can hold any type of value.
  • Arrays can be nested arbitrarily deep.
  • Access elements via zero-based indices (e.g., myList[0]).

What’s Next?

Arrays become more powerful when combined with loops and array methods—stay tuned for the next video on array properties and methods!

AI Assistant

Sign In Required

Sign in and subscribe to use the AI assistant for instant help with your lessons.

Sign In

Basic Arrays in Javascript

In this lesson, you'll learn how to create arrays that can store a variety of data types, explore the concept of nested arrays, and gain essential skills for accessing and manipulating array elements effectively.

2m 19s

Course Content

0 of 32 lessons completed
6. Promises, Async and Await
0 of 0 completed
7. The DOM
0 of 0 completed