More array mutation

These methods also mutateThe process of changing data. the array.

Name Meaning
.splice(i, num, itemOne, itemTwo) splices in the items to add (the third and following arguments) at index i while removing num items, and returns an array of the items removed
.reverse() reverses the order of the items and returns the modified array
.sort() sorts the items in alphabetical order and returns the modified array

Note:

Hints:

  • undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
var animals = ["ape", "bee", "eel", "fox"];
var mixed = ["one", 2, "three", "four", 5];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX