ES6 - Méthode Array concat ()

La méthode concat () renvoie un nouveau tableau composé de ce tableau joint à deux tableaux ou plus.

Syntaxe

array.concat(value1, value2, ..., valueN);

Paramètres

  • valueN - Tableaux et / ou valeurs à concaténer avec le tableau résultant.

Valeur de retour

Renvoie un nouveau tableau.

Exemple

var alpha = ["a", "b", "c"]; 
var numeric = [1, 2, 3];
var alphaNumeric = alpha.concat(numeric); 
console.log("alphaNumeric : " + alphaNumeric );

Production

alphaNumeric : a,b,c,1,2,3