How to join (merge) three arrays in JavaScript

2 Answers

0 votes
const arr1 = ["javascript", "php", "c++", "python"];
const arr2 = ["css", "html", "bootstrap"];
const arr3 = ["c", "c#"];

const arr1arr2arr3 = [...arr1, ...arr2, ...arr3]
 
console.log(arr1arr2arr3);
 
  
  
/*
run:
        
["javascript", "php", "c++", "python", "css", "html", "bootstrap", "c", "c#"]
      
*/

 



answered Nov 29, 2020 by avibootz
0 votes
const arr1 = ["javascript", "php", "c++", "python"];
const arr2 = ["css", "html", "bootstrap"];
const arr3 = ["c", "c#"];

const arr1arr2arr3 = arr1.concat(arr2).concat(arr3)
 
console.log(arr1arr2arr3);
 
  
  
/*
run:
        
["javascript", "php", "c++", "python", "css", "html", "bootstrap", "c", "c#"]
      
*/

 



answered Nov 29, 2020 by avibootz

Related questions

3 answers 241 views
2 answers 204 views
2 answers 200 views
200 views asked Jun 9, 2015 by avibootz
1 answer 210 views
3 answers 448 views
...