javascript-today

Arrays

Arrays are an integral part of JavaScript that I use everyday and might be one of the most important things in the language. Since at the core of most data crunching or coding is the idea of repetition over a series of some sort and with javaScript you will find arrays to be your best friend.

An array is an unordered collection of stuff, that stuff can be strings, numerals, or objects. In JavaScript it is designated by the use of square brackets ( [] ).

example of an array of objects:

let exampleArray = [
  { "id": "123", "myText" : "Hello there" },
  { "id": "124", "myText" : "What is up today" },
  { "id": "125", "myText" : "Blue" },
]

in the above example there are three array elements of object where the objects are defined within curly brackets ({})

Arrays also contain the useful property of length so that it is always quick and easy to get how many elements an array contains.

Next Article: Array Methods