DEV Community

Manikandan K
Manikandan K

Posted on • Edited on

2 1

Js Array Methods

1. Array.length()

To find length of an Array using array.length method

Image description

2. Array.concat()

  • To join two or more than two array.
  • Returns new array.
  • New array will not change existing array.

Image description

3. Array.every()

  • To check given condition in every array element and returns boolean
  • Every array element will pass the test return 'true'
  • Any one element will fail the test return 'false'

Image description

4. Array.fill()

  • Array.fill() method fills some specify element in an array.
  • It affects original array.
  • Start and end position will not specified, entire array elements fills with given value

Image description

5. Array.find()

  • Array.find() method return the condition will be true the first element in given array.
  • If condition will not pass in given array it return 'Undefined'

Image description

6. Array.findIndex()

  • FindIndex method return the index position where the condition first satisfy.
  • If condition will not satisfy return -1.

Image description

7. Array includes()

  • Includes method return boolean value.
  • If given specified value in array it will return true else return false.
  • Include method is case sensitive.

Image description

8. Array.push()

  • Array push method insert a new element at last position in given array.
  • Push method will affect original array.

Image description

9. Array.pop()

  • Array pop method remove last element in given array.
  • It will also affect original array.

Image description

10. Array.shift()

  • Shift method will remove the first element of the array.
  • It will changes the original array.

Image description

11. Array.unshift()

  • Unshift method will add the new element at first position of the array.
  • It will overwrites the original array.

Image description

12. Array.slice()

  • Slice method return a new copy of array when selected element.
  • It like The slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end.

Image description

13. Array.sort()

  • Sort method return sorted array.

Image description

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay