As shown above, the arrays arr 1
and arr 2
are concatenated to produce arr 3
. The resulting array arr 3
has both the elements of the first array as well as the second array. This method will prove to be useful when you want to split a big array into different smaller arrays for specific calculations before making them a big array again. The arrayname.concat()
method is similar to the concat()
method used when adding two strings together.