반응형
JavaScript array에는 유용한 함수들이 많습니다.
자세한 내용은 여기를 참고하세요.
concat()
: concat 메서드는 두 개 이상의 배열을 병합하여 새 배열을 만들어 반환합니다.
Syntax: concat(sourceArray2);
const sourceArray1 = ['a', 'b', 'c'];
const sourceArray2 = ['d', 'e', 'f'];
const newArray = sourceArray1.concat(sourceArray2);
// 결과값: Array ["a", "b", "c", "d", "e", "f"]
console.log(newArray);
반응형
'WEB > JS|Node.js' 카테고리의 다른 글
JavaScript Operator - Spread & Rest (0) | 2022.08.31 |
---|---|
JS Array functions (5) - reduce() (0) | 2022.08.28 |
JS Array functions (3) - slice(), splice() (0) | 2022.08.28 |
JS Array functions (2) - find(), findIndex() (0) | 2022.08.28 |
JS Array functions (1) - map(), filter() (0) | 2022.08.28 |