reverse method reverses an array. The changes will be made in the original array.
This method takes the array to be reversed as an argument.
This method reverses the original array provided as an argument and returns it.
The below code demonstrates the use of the
reverse method in Lodash:
Line 6: We load the
Lodash library file from the server link.
Line 8: We create an array
[1,2,3,4,5] as elements.
Line 11: We use the
reverse method to reverse the array. This will reverse the order of the elements on the source array and returns it. Now the array is
View all Courses