
Reverse() function is used to reverse the order of the array such that the first element becomes the last and the last element becomes the first.
Sort method is used to arrange the elements of the array in ascending order var arr = var arr = Ĭonsole.log(arr) // prints 1, 3, 'abc', 'bbc'Ĭonsole.log(arr) // prints 1, 3 sort() function in nodejs: If the user provides an index, howMany, and values(elements) to the splice() function then splice() will insert the given details but if we do not provide value then the splice() function will remove element from the given index with howMany elements. If you don't specify any elements, splice simply removes the elements from the array. , elementN − The elements to add to the array.

If howMany is 0, no elements are removed.Įlement1. HowMany − An integer indicating the number of old array elements to remove. Index − Index at which to start changing the array. Splice() function can be used in two ways i.e to either add the element into the array or remove the elements from the array.
