> For the complete documentation index, see [llms.txt](https://shhn0509.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shhn0509.gitbook.io/javascript/js-upgrade/method/object.md).

# Object 메서드

## [Object.assign() ](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)

하나 이상의 출처 객체로부터 대상 객체로 속성을 복사할 때 사용한다.&#x20;

```javascript
const newObj = Object.assign(obj1, obj2)
```

&#x20;메서드의 첫 번째 인자의 객체에 두 번째 인자 객체가 합쳐진다.&#x20;

```javascript
cosnt obj1 = {a: 1, b: 2}
cosnt obj2 = {c: 3, d: 4}

const newObj = Object.assign(obj1, obj2)

newObj // {a: 1, b: 2, c: 3, d: 4}
obj1 // {a: 1, b: 2, c: 3, d: 4}
obj2 // {c: 3, d: 4}
```
