Array Methods in JavaScript Part 2
Array Methods in JavaScript Part 2
Array
Methods
in
JavaScript
PART -2
Push Method
In JavaScript, the push() method is an array
method that adds one or more elements to
the end of an array and returns the new
length of the array. Example :-
console.log(fruits);
// Output: ['apple', 'peach']
console.log(removedFruits);
// Output: ['banana']
Slice Method
In JavaScript, the slice() method is an array
method that returns a shallow copy of a portion
of an array into a new array, without modifying
the original array.
fruits.reverse();
console.log(fruits);