Definition: Mutates an array by appending the given elements and returning the new length of the array. This method changes the length of the array.
Definition: Removes the last element from an array and returns that element. This method changes the length of the array.
Definition: Removes the first element from an array and returns that element. This method changes the length of the array.
Definition: Adds one or more elements to the beginning of an array and returns the new length of the array. This method changes the length of the array.
Changes the contents of an array, removing n elements starting at the specified index while adding new elements at the specified index.
Splice could be also summed up as "it's a lot like Push, but it allows you to insert a new element at a specific index instead of just the end of the array".
To help clarify Splice's uses, let's run through a couple of examples.
Here we're using Splice to add the number 4 at the proper place in the array. Everything here should be pretty straight forward, but let's take a closer look at the numElementsToRemove. What happens if we increment that number to 1?
Here, Splice is adding the 4 at the third index and then removing one element after the third index.
Despite what the documentation says, you can call Splice with a single argument. However, from the sounds of it, you really shouldn't.
Calling Splice with a single argument returns all elements up to the index specified (e.g., imputing the number four will return indexes one through three). Again, this behavior isn't exactly standard, so I'd avoid using it just in case it gets depreciated down the road.
Well, I hope you've found this introduction to Splice helpful. If you have any questions or notice something I may have misstated, please leave a comment.