JavaScript array mutators
There are several methods that can be used with the array object in JavaScript. Some methods modify the array object while the others do not. The methods that modify the array object are called as mutator methods. The following are the examples of non-mutator methods contains indexOf lastIndexOf The following are the examples of mutator methods push pop shift unshift reverse sort splice We discusssed push(), pop(), shift() and unshift() methods in Part 20. In this video we will discuss sort reverse splice JavaScript sort method : Sorts the elements of an array. By default, the sort() method sorts the values by converting them to strings and then comparing those strings. This works well for strings but not for numbers.