tistory view

Javascript

concat() 메소드

Jane Doe 2022. 2. 7. 19:43

 

concat() 메소드 - 

 

인자로 주어진 배열이나 값들을 기존 배열에 합쳐서 새 배열을 반환함.

 

기존배열을 변경하지 않음.

추가된 새로운 배열을 반환함.

 


const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);

console.log(array3);
//expected output: Array ["a", "b", "c", "d", "e", "f"]

 

 

 

'Javascript' 카테고리의 다른 글

reduceRight() 메소드  (0) 2022.02.07
reduce() 메소드  (0) 2022.02.07
join() 메소드  (0) 2022.02.07
pop() 메소드  (0) 2022.02.07
splice() 메소드  (0) 2022.02.07
comment
© 2022 Jane Doe