top of page
Search

Slice and splice

  • zakariyesahid96
  • Feb 2, 2022
  • 1 min read

To recap what I learnt from this topic:

  • Slice is used for coping portion of an array.

  • Splice is for removing or replacing elements.

  • To demonstrate slice

let colors= ['red','orange']

Let CoolColors=colors.splice(1)

A digit needs to be added to show where to start the slice from.


  • For splice the same principle is used at the end of a variable but what this does is change the array by removing or replacing it.

  • Lastly sort is used to default sort in ascending but doesn't sort of in numerical order.

 
 
 

Kommentit


Post: Blog2_Post
  • Facebook
  • Twitter
  • LinkedIn

©2021 by zaktech96. Proudly created with Wix.com

bottom of page