JavaScript Concatenating Arrays

The concat() method is used to concatenate 2 or more strings in JavaScript.

The usage is as follows...

var fruit = ['apple', 'orange', 'kiwi']; var num = [1, 2, 3]; var conc = fruit.concat(num); for (let itm of conc) { document.write(itm); document.write("
"); }

The result will be like this..

apple
orange
kiwi
1
2
3



You May Interest

What are Control Flow Statements in Javascript ?

What is Promise in Javascript ?

Javascript Removing Elements from Array

What are Different Javascript Frameworks ?

JavaScript Using While Loop