🐨CoalaCoding
DocsExamplesTry itBoardB반
🐨CoalaCoding

개발자를 위한 한국어 웹 기술 문서

문서

  • JavaScript
  • Web Publishing
  • React
  • Python

커뮤니티

  • 게시판
  • 예제 모음
  • Try it 에디터

기타

  • GitHub
  • 관리자
© 2026 CoalaCoding. All rights reserved.
  • 01_start
  • 02_class
  • 03_ai이미지-생성기-구현
  • 04_자료형
  • 05_async--await
  • 06_변수와자료형
  • 07_xmlhttprequest-부터axios-까지
  • 08_1-자바스크립트와-ecma
  • 09_reduce
  • 10_캘린더-만들기
  • 11_generator
  • 12_destructuring
  • 13_spread-operator
  • 14_module-export-import
  • 15_http-통신-이란
  • 16_시작
  • 17_2-자바스크립트-코드-실행-과정-및-용어정리
  • 18_map
  • 19_동기와-비동기
  • 20_연산자
  • 21_promise-thencatch
  • 22_3-실행컨텍스트와-스코프
  • 23_콜백-함수
  • 24_제어문
  • 25_4-클로저
  • 26_windowlocation
  • 27_함수
  • 28_5-객체
  • 29_이벤트
  1. 홈
  2. 문서
  3. JavaScript
  4. JavaScript 기초
  5. 13_spread-operator

13_spread-operator

코드 블록의 Try it Yourself 버튼으로 직접 실행할 수 있다.

구문

Spread operator란?

… 반복가능한(이터러블:iterable) 객체를 반환하는 표현식 앞에 표기하여 요소를 펼칠수있다 이 연산자를 사용하면 기존의 요소를 유지하면서 새로운 요소를 ****추가하거나, 요소를 수정할 수 있습니다.

//array
const arr1 = [1, 2, 3];
const arr2 = [4, 5, 6];
const arr3 = [...arr1, ...arr2]; // [1, 2, 3, 4, 5, 6]
const arr4 = [...arr1]; // [1, 2, 3]


//object
const obj1 = { a: 1, b: 2 };
const obj2 = { c: 3, d: 4 };
const obj3 = { ...obj1, ...obj2 }; // { a: 1, b: 2, c: 3, d: 4 }
const obj4 = { ...obj1 }; // { a: 1, b: 2 }

//string
const str = "hello";
const arr = [...str]; // ["h", "e", "l", "l", "o"]

목차

  • 구문