Array - Splice vs Slice

Input

Array 1 [20, 10, 5, 12, 2]

Array 2 [20, 10, 5, 12, 2]

Array 3 []

Splice
Slice
Others
Note:
  • Splice - The original array will be modified. Thus, move can be done only once because original array is no more after the clone.
  • Slice - The original array will not be modified.
Output
Array 1
Splice Extract
Array 2
Slice Extract
Array 3
Coding Techniques Used
  • splice(), slice() method
  • CSS: Flexbox