remove first 3 elements from array javascript code example
Example 1: remove first element from array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
Example 2: remove first element from array javascript
const array1 = [1, 2, 3];
const firstElement = array1.shift();
console.log(array1);
console.log(firstElement);
Example 3: remove first element of array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits.shift()
Example 4: delete from array javascript
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];var removed = arr.splice(2,2);
Example 5: javascript array remove first
let yourArray = ["aaa", "bbb", "ccc", "ddd"];
yourArray.shift();
Example 6: js array.splice first element
var indexToRemove = 0;
var numberToRemove = 1;
arr.splice(indexToRemove, numberToRemove);