Diverse Arrays Operation In JavaScript

Imran Hossain
Nov 2, 2020

Arrays are list-like objects which contains a group of elements. Arrays stored data in a very organized manner as a result data can be easily stored or searched.

Let’s play with Array Operation

Method push/unshift

· push adds an element to the end

· unshift add an element to the beginning.

push and unshift operation

Method pop/shift

· pop remove an element from the end

· shift removes an element from the beginning.

pop and shift operation

Multiple arrays concatenate using (…three Dots) spread operator

Multiple Array concatenate using spread operator.

Spread Operator Operation

map, filter, find on an array of objects

map, find, filter operation

Array element slice and spice

· The splice() method changes an array by adding or removing elements from it them returns the removed item(s) in an array and slice() method copies a given part of an array then returns the selected element in an array, as a new array object.

· The splice() method changes the original array whereases slice() method doesn’t change the original array.

slice operation:

slice() operation

splice operation:

splice() operation

--

--

Imran Hossain
0 Followers

I am Imran Hossain. I am from Bangladesh. I am a Web Developer and hobby Writer and Graphics Designer.