Side navigation
#10158 closed feature (worksforme)
Opened August 29, 2011 12:05AM UTC
Closed August 29, 2011 12:23AM UTC
Extend only existing properties
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | core | Version: | 1.6.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
var object1 = {
apple: 0,
banana: {weight: 52, price: 100},
cherry: 97
};
var object2 = {
banana: {price: 200},
durian: 100
};
/* merge object2 into object1 */
$.extend(object1, object2, true);
// Output (no durian!):
// { apple: 0, banana: { price: 200 }, cherry: 97 }
Attachments (0)
Change History (1)
Changed August 29, 2011 12:23AM UTC by comment:1
| component: | unfiled → core |
|---|---|
| priority: | undecided → low |
| resolution: | → worksforme |
| status: | new → closed |
Works for me: http://gyazo.com/c87038f3f474289a7947f7410a622975.png
http://jsfiddle.net/rwaldron/RSRRq/
If you're trying to tell us that you don't want the
durianproperty, then you've misunderstood the semantics ofextend