programming/JavaScript&jQuery

[jQuery] 제이쿼리 오브젝트 합치기 - jQuery.extend()

LeeBorn 2019. 8. 21. 23:17
반응형

제이쿼리를 사용해서 오브젝트를 합칠 때 사용하는 함수는 extend() 가 있다.

이때 사용법은 아래와 같이 사용할 수 있다.

var object = $.extend({}, object1, object2);

 

extend 사용법

위의 코드와 같이 사용하면, 아래처럼 실행된다.

합쳐지긴 합쳐지는데 사용법에 따른 차이는 아래 문서에서 좀 더 자세하게 확인할 수 있다.

 

https://api.jquery.com/jquery.extend/

 

jQuery.extend() | jQuery API Documentation

Description: Merge the contents of two or more objects together into the first object. When two or more object arguments are supplied to $.extend(), properties from all of the objects are added to the target object. Arguments that are null or undefined are

api.jquery.com

 

반응형