Array.prototype.concat()

So'sCode·2022년 1월 21일
0

Method 정리

목록 보기
2/8
post-thumbnail

📌concat() 메서드란?

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

  • 기존배열을 변경❌
  • 추가된 새로운 배열을 반환
  • 사용방법 : array.concat([value1[, value2[, ...[, valueN]]]])

💻 예시

const astro1 = ['MJ', '진진', '차은우'];
const astro2 = ['문빈', '라키', '윤산하'];
const member = astro1.concat(astro2);

console.log(member);
// expected output: Array ["MJ", "진진", "차은우", "문빈", "라키", "윤산하"]

출처 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

profile
이왕하는거미루지말고하자.

0개의 댓글