Back to Freecodecamp

Learn Arrays and Loops Lesson A

curriculum/challenges/english/blocks/top-learn-arrays-and-loops/661e27508602567c118451d1.md

latest1.0 KB
Original Source

--description--

Strings and numbers may be our building blocks, but as your scripts get more complex, you're going to need a way to deal with large quantities of them. Luckily, JavaScript has a couple of data types that are used for just that. An array is an ordered collection of items (Strings, numbers, or other things).

Arrays are a way to store multiple values in a single variable. They are a special type of object that has a length property and a series of numbered properties. Each numbered property is called an element, and each element can store a value of any type.

An example of an array is:

javascript
const fruits = ['apple', 'banana', 'orange'];

--questions--

--text--

What is an array in JavaScript?

--answers--

A function that stores multiple strings and numbers.


A data type used exclusively for numerical operations.


An ordered collection of items that can store values of any type, including strings and numbers.


A variable that can only store string values.

--video-solution--

3