In JavaScript Array is a special variable that can hold/store multiple values under a single name. Array in JavaScript can store value with any data type and can also store mixture of various data types.
Creating An Array:
const arrayName = [value1, value2 ,value3];
const names = ["Alok", "Shubham", "Divya", "Abhi", "Abhay", "Ankit"];
console.log(names);
// Output ["Alok", "Shubham", "Divya", "Abhi", "Abhay", "Ankit"]
There are various methods provided by JavaScript, we can categorise broadly it into four parts:
1.Basic Array Methods
- concat():
- slice()
- reverse()
- join()
2.Array Manipulation Method
- shift()
- unshift()
- push()
- pop()
- splice()
3.Higher Order Function
- forEach()
- map()
- filter()
- find()
- findIndex()
- every()
- some()
- reduce()
4.Basic Array Check Method
- indexOf()
- lastIndexOf()
- includes()
- length