JavaScriptNo Comments

default thumbnail

Slide() method is used to add or remove an items from an array in javascript. Find the index of the element you want to remove by using indexOf().


const array = [3, 5, 7, 9, 11];
array.splice(1, 3);

// array = [5, 7]

//Result is  5,7

The slice() method selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.

Be the first to post a comment.

Add a comment