JavaScirpt Arrays 2

Following are some examples of Array functions.

How to use Join function in Arrays

array.join()

array.join(string)

The join method converts all the elements to strings and then concatenates all the strings into a longer string. If an argument is provided in the parameter list, it is used to separate the elements in the string returned by the method.

How to use concatenate function of Arrays

The concat() method adds the elements listed in the parameter list to end of the existing array and returns the result.

arg1,…argN contains one or more elements to be concatenated to the end of the array

The original is not changed by this method. Please see below image as a reference:

javascript-tutorials-arrays

Reverse Method

The reverse() method reverses the order of the elements in the array according to the array index numbers. Please see below image as a reference:

javascript-tutorials-arrays