What is an array?

The array is stored multiple values in a single variable. In JavaScript array is an object. Array index start from 0 1 2 3 4….n first element 0 index second 1 index.

store multiple data in a names variable

Important Function in javaScript array

  1. length

The javascript array length function returns the number of elements in an array. If there are no elements in the array length function return 0.

2. push

The push function adds a new item to the end array.

3. pop

The pop function removes the last item in an array.

remove the last item from names

4. shift

The shift function removers the first item in an array.

remove the first item from names

5. unshift

The unshift function adds the first item in an array.

6. indexOf

The indexOf function returns the index number.

7.sort

The sort function sorting the items.

8. splice

The slice function receives two parameters that remove items from the first parameter to the second parameter.

9.revers

The reverse function reverses an array of items.

10. isArray

The isArray function returns true or false if check the variable are array return true other always return false.

Thank you for reading…:)