Codecademy JS Basics - Arrays
Array Functions
push() - adds items to the array slice() - returns a segment of the array length() - returns the length of the array shift() - removes the first element in an array indexOf() - returns the index of a given value pop() - removes the last element from an array unshift() - adds an element to the beginning of an array, requires an argument
Elements in an array
- Arrays in JavaScript are zero-indexed, meaning the positions start counting from 0 rather than 1 - elements can be called using the following notation: arrayName[0]; - Elements can be adjusted outside the array
Arrays
-way of making lists. -Arrays can store any data types (including strings, numbers, and booleans). -arrays are ordered, meaning each item has a numbered position. -declared like any other variable in JS