Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Introduction to Arrays | Advanced Primitives and Reference Types
JavaScript Data Types Foundations

bookIntroduction to Arrays

Arrays are a powerful way to organize and manage collections of data in JavaScript. You will encounter arrays in many real-world situations, such as storing the items in a shopping cart, keeping track of a list of tasks, or managing user input in a form. Arrays allow you to group related values together, making it easier to process and manipulate them as a unit.

12345678
// Create an array of shopping cart items const shoppingCart = ["apple", "banana", "orange"]; // Access the first item in the array console.log(shoppingCart[0]); // Output: "apple" // Access the second item in the array console.log(shoppingCart[1]); // Output: "banana"
copy

Arrays use numeric indexing, starting from 0. This means the first element is at index 0, the second at index 1, and so on. You can retrieve any item by its index. Arrays also have a length property, which tells you how many elements are in the array. For example, if your array has three items, its length will be 3. This property is especially useful when you need to loop through an array or check if it contains any elements.

question mark

Which statement about JavaScript arrays is correct?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 3

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Awesome!

Completion rate improved to 6.25

bookIntroduction to Arrays

Veeg om het menu te tonen

Arrays are a powerful way to organize and manage collections of data in JavaScript. You will encounter arrays in many real-world situations, such as storing the items in a shopping cart, keeping track of a list of tasks, or managing user input in a form. Arrays allow you to group related values together, making it easier to process and manipulate them as a unit.

12345678
// Create an array of shopping cart items const shoppingCart = ["apple", "banana", "orange"]; // Access the first item in the array console.log(shoppingCart[0]); // Output: "apple" // Access the second item in the array console.log(shoppingCart[1]); // Output: "banana"
copy

Arrays use numeric indexing, starting from 0. This means the first element is at index 0, the second at index 1, and so on. You can retrieve any item by its index. Arrays also have a length property, which tells you how many elements are in the array. For example, if your array has three items, its length will be 3. This property is especially useful when you need to loop through an array or check if it contains any elements.

question mark

Which statement about JavaScript arrays is correct?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 3
some-alt