跳到主要内容

$.extend

$.extend(target, [source, [source2, ...]]) ⇒ target
$.extend(true, target, [source, ...]) ⇒ target [v1.0]

Extend target object with properties from each of the source objects, overriding the properties on target.

By default, copying is shallow. An optional true for the first argument triggers deep (recursive) copying.

var target = { one: 'patridge' },
source = { two: 'turtle doves' }

$.extend(target, source)
//=> { one: 'patridge',
// two: 'turtle doves' }