![]() 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. reverse() function does not accept any parameter. Sometimes you might need to sort the array in descending order but we do not have such functionality in nodejs. ![]() ![]() prints 'jack fruit','grape','mango','kiwi','apple' join() : In such kind of case, we can sort the array in ascending order then reverse it, so we will get descending order var arr = Ĭonsole.log(arr) // prints 3, 9, 1 concat()Ĭoncat method is used to join two arrays and returns a new array consisting of the elements of both the arrays one after another. Join() method is used to join the array elements into a string and return the string. The elements will be separated by a specific separator while joining the array elements, which will be passed while calling the method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |