JavaScript concat()

1 개요[ | ]

JavaScript 배열 concat()
JavaScript
Copy
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
console.log(array3); // ["a", "b", "c", "d", "e", "f"]
["a", "b", "c", "d", "e", "f"] 
JavaScript
Copy
const letters = ["a", "b", "c"];
const numbers = [1, 2, 3];
const alphaNumeric = letters.concat(numbers);
console.log(alphaNumeric); // ['a', 'b', 'c', 1, 2, 3]
["a", "b", "c", 1, 2, 3] 
JavaScript
Copy
const num1 = [1, 2, 3];
const num2 = [4, 5, 6];
const num3 = [7, 8, 9];
const numbers = num1.concat(num2, num3);
console.log(numbers); // [1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8, 9] 
JavaScript
Copy
const letters = ["a", "b", "c"];
const alphaNumeric = letters.concat(1, [2, 3]);
console.log(alphaNumeric); // ['a', 'b', 'c', 1, 2, 3]
["a", "b", "c", 1, 2, 3] 

2 참고[ | ]