What is Splice & Slice method in Javascript

1. Slice() and Splice() are core JavaScript method.
2. Both Sounds like same but both are different.
3. Both use for Manipulate the Array.

Code Sample [All Html & Jquery]

Slice Method();

Slice take two parameter where second one is optional.

Both Parameter is integer type .

First Parameter is where to use the selection & second is where to end the selection.

Its copy the original Array and not modify the original Array.

Array starts from zero. So if you right down 1 in first parameter then its select second element of Array.

If a single argument is given to the slice() method, the array returned will contain all elements from the start position to the end of array.

If you not pass any parameter and just call this then its copy the original array.If a negative value is supplied for either parameters, this means that the slice() will count the position from the end of the array, instead of the beginning.
So please check for better understading.

Splice Method();

splice() method used for add or remove items from an array.

splice take three parameter where third one is optional.

First two Parameter is integer type and third one is any type .

First Parameter is where to use the selection & second is number of elements to remove & third one is new elements to be added.

It modify original Array .

Array starts from zero. So if you right down 1 in first parameter then its select second element of Array.

If a single argument is given to the splice() method, the array remove all elements from the start position to the end of array.