workabout

What is the difference between slice and splice?

Some of the major difference in a tabular form

Slice

  • Doesn't modify the original array(immutable)

  • Returns the subset of the original array

  • Used to pick the elements from an array

Splice

  • Modifies the original array(mutable)

  • Returns the deleted elements as an array

  • Used to insert or delete elements to/from an array