0

JavaScript arrays are used to store multiple values in a single variable.
An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Log each array item to the console and You can create array by simply assigning values as follows

const datarray = [‘car’, ‘truck’, ‘bus’];
datarray.forEach( datarray => console.log(datarray) );

// Will log the following:
// ‘car’
// ‘truck’
// ‘bus’

JavaScript arrays

Changed status to publish
Add a Comment