ModernNerd Code
Published in

ModernNerd Code

Some Powerful Things You Can do With the Array Splice Method in JavaScript

The splice method of the Array prototype in JavaScript is quite powerful when it comes to adjusting the contents of an array in place. You can use it to remove elements, add elements, reposition elements, and even swap elements. According to Mozilla, this is the function of Array.prototype.splice():

The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. — MDN Web Docs

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store