01
MASTER JAVASCRIPT
ARRAYS LIKE A PRO!
02
TO MUTATE THE
ORIGINAL ARRAY
Add to original
.push .unshift
(end) (start)
Remove from original
.pop .shift .splice
(end) (start) (any)
Others
.reverse .fill .sort
03
A NEW ARRAY
Computed from original
.map (loop)
Filtered using condition
.filter
Portion of original
.slice
Adding original to other
.concat
Flattening the output
.flat .flatMap
04
AN ARRAY INDEX
Based on value
.indexOf
Based on test condition
.findIndex
AN ARRAY ELEMENT
Based on test condition
.find
05
KNOW IF ARRAY
INCLUDES
Based on value
.includes
Based on test condition
.some .every
A NEW STRING
Based on separator string
.join
06
TO TRANSFORM TO
VALUE
Based on accumulator
.reduce
(Accumulate into a single value )
TO JUST LOOP ARRAY
Based on callback
.forEach
(Does not create a new array,
only loops over the original array)
07
REPOST,
IF YOU LOVED THE POST!
Save this guide and share it with your
network! Let's make array manipulation
simpler and smarter.