Jacob Johns

aspiring developer

Basic Data Structures

Data can be stored and access in many ways such as arrays and objects

Arrays to Store a Collection of Data

arrays can contain booleans, strings, and numbers, among other valid JS data types


Access Array's Contents Using Bracket Notation

the fundamental feature of any data structure is the ability to retrieve data as well as store


Add Items to an Array

push() and unshift() giveth


Remove Items from an Array

pop() and shift() taketh away


Remove Items Using splice()

remove any number of consecutive elements from anywhere in an array


Adding Items Using splice()

the third parameter can be used to add to the array


Copy Array Items Using slice()

extract a given number of elements to a new array, leaving the array it is called upon untouched


Copy Array with Spread Operator

ES6's new spread operator easily copies all of an array's elements


Combine Arrays with Spread Operator

combine arrays, or insert elements of one array into another, at any index


Check for Presence of Element with indexOf()

allows a quick and easy check for the presence of an element on an array


Iterate Through All an Array's Items using For Loops

it is very handy to be able to iterate through each item to find one or more elements