js get part of array
let fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'] let citrus = fruits.slice(1, 3) // fruits contains ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'] // citrus contains ['Orange','Lemon']
Here is what the above code is Doing:
1. The original array is copied to a new array.
2. The new array is sorted.
3. The sorted array is displayed.
4. The original array is displayed.