Arrays of Values
Learn and practice manipulating arrays of values in JavaScript.
What is an array
In JavaScript, an array is a collection of values. It is a comma-separated list of values enclosed in a pair of square brackets. An array can be stored as a single variable. For example, ["apple", "mango", "banana"]
is an array of strings. It can be stored as a variable, as shown in the code below:
In the code above:
-
Line 1: We use a variable,
arrayOfFruits
, to assign the comma-separated values enclosed in square brackets. -
Line 2: We list the array’s values horizontally using
console.log()
.
Note: When we print a complete array using
console.log()
, it shows a symbol ...
Access this course and 1400+ top-rated courses and projects.