# javascript assign vs jquery extend

extend는 객체를 merge할 때도 사용하고, 복사를 사용할 때도 사용합니다.&#x20;

(주로 복사를 할 때 사용합니다.)

{% embed url="<https://gomakethings.com/vanilla-javascript-version-of-jquery-extend/>" %}

{% embed url="<https://www.pixelstech.net/article/1477888746-Deep-clone-of-JavaScript-object>" %}

객체를 merge 할 때 jquery에서는 extend를 사용하고 javascript에서는 assign을 한다고 한다.&#x20;

그리고 객체의 복사에는 shallow copy, deep copy가 있는데

shallow copy는 객체의 레퍼런스만 복사를 하고,

deep copy는 객체의 레퍼런스, 컨텐츠들을 복사를 합니다.&#x20;

jquery의 extend는 shallow copy를 하고

javascript의 assign은 deep copy를 합니다.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://scarlett-dev.gitbook.io/all/js/javascript-assign-vs-jquery-extend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
