#14722 closed bug (notabug)
Recursively extending as object with another object with an empty array parameter
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 2.0.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var obj1 = {'key': {'subkey': 1} } >> Object {key: Object} var obj2 = {'key': [] } >> Object {key: Array[0]} $.extend(true, obj1, obj2) >> Object {key: Array[0]}
I would expect the result to still contain the 'subkey' object; instead it is replaced by an empty array.
Change History (4)
comment:1 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 follow-up: 4 Changed 9 years ago by
This wouldn't be a problem if you'd define an Arrobject in ES7.
comment:4 Changed 9 years ago by
Note: See
TracTickets for help on using
tickets.
This is the correct behaviour, jQuery.extend will not attempt to "merge" an Array and an Object.