Arrays in JavaScript let you store multiple values in a single variable. They are one of the most used data structures in JS — super handy for lists, collections, and sequences.
fruits[0]
gets the first item.
push()
— Adds an element to the endpop()
— Removes the last elementshift()
— Removes the first elementunshift()
— Adds an element at the startslice(start, end)
— Returns a section of the arraysplice(start, deleteCount)
— Adds/Removes elementsforEach(callback)
— Loops through each elementmap(callback)
— Creates a new array with modified itemsmap()
to Modify Arrayslength
property to get array size: array.length
map()
and filter()
return new arrays.