top of page
Search
zakariyesahid96

Slice and splice

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.

2 views0 comments

Recent Posts

See All

Commenti


Post: Blog2_Post
bottom of page