JS Slice

JS Slice

·

1 min read

Twitter Youtube Reference

Slices the array and returns shallow copy.

Doesn't mutate (alter) original array

Array Slice

Case 1: Array of strings, booleans and numbers

#1:

Screenshot 2022-01-14 at 12.20.07 PM.png

#2:

Screenshot 2022-01-14 at 12.26.06 PM.png

#3: Knowledge Test.

Answer // 1 & // 2 in comment section.

Screenshot 2022-01-14 at 12.36.12 PM.png

Case 2: Array of Objects

Screenshot 2022-01-14 at 1.14.20 PM.png

String Slice

#1:

Screenshot 2022-01-14 at 1.32.09 PM.png

#2: Knowledge Test:

Answer // 1 in comments

Screenshot 2022-01-14 at 1.35.49 PM.png