[Javascript] Array.prototype.concat()

Yuri Lee·2021년 11월 19일
0

Array.prototype.concat()

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"]

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

profile
Step by step goes a long way ✨

0개의 댓글