Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

joining two array

//for ES5
var array1 = ["Rahul", "Sachin"];
var array2 = ["Sehwag", "Kohli"];

var output = array1.concat(array2);
console.log(output);

//for ES6, we use spread operators to concat arrays

var array1 = ["Dravid", "Tendulkar"];
var array2 = ["Virendra", "Virat"];
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #joining #array
ADD COMMENT
Topic
Name
3+8 =