Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Array

Array

Anarray is an ordered collection of data (eitherprimitive orobject depending upon the language). Arrays are used to store multiple values under a single variable name. A regular variable, on the other hand, can store only one value.

Each item in an array has a number attached to it, called a numeric index, that allows you to access it. In JavaScript, arrays start at index zero and can be manipulated with variousmethods.

Arrays in JavaScript look like this:

js
// Arrays in JavaScript can hold different types of dataconst myArray = [1, 2, 3, 4];const barbieDollNamesArray = ["Barbie", "Ken", "Midge", "Allan", "Skipper"];// Array indexes starts at 0.console.log(myArray[0]); // output: 1console.log(barbieDollNamesArray[2]); // output: "Midge"

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp