Language:

Search

7 Must-know Fundamental Array Methods in JavaScript

  • Share this:
7 Must-know Fundamental Array Methods in JavaScript

Check out the MUST-KNOW array fundamental methods in JavaScript.

1. PUSH

The Array.Push() adds a new element, containing the entered variable, to the end of the array.

carbon-1024x551.png

2. POP

The Array.Pop() method on the other hand, does quite the opposite, deleting the last element of an array.

carbon-1-1024x551.png

3. SHIFT

Shift works almost exactly like POP, with one major difference. It deletes the first value in an array and moves the rest backwards.

carbon-2-1024x551.png

4. UNSHIFT

Unshift adds a new value to the start of an array instead of the end (Like the PUSH does)

carbon-3-1024x551.png

5. SPLICE

It's first argument determines where to add new elements.

The Second argument is how many after that point should be deleted.

All other arguments are values you're adding.

carbon-4-1024x520.png

6. SLICE

Slice creates a new Array that contains every element from a certain point on in whatever array you give it!

carbon-5-1024x551.png

7. CONCAT

Concat returns a new array with all members of the current one & adds item to it.

carbon-6.png
Usama Muneer

Usama Muneer

A web enthusiastic, self-motivated & detail-oriented professional Full-Stack Web Developer from Karachi, Pakistan with experience in developing applications using JavaScript, WordPress & Laravel specifically. Loves to write on different web technologies with an equally useful skill to make some sense out of it.