Skip to content Skip to sidebar Skip to footer

Javascript, Deep Extend

So I have an object I'm trynig to deep extend into - right now the extend function works if the lowest level is just an array, So it looks like this : function(base, next) {

Solution 1:

http://jsfiddle.net/p08ayvv8/
this fiddle shows you how jQuery can deal with (deep) extending objects.
See http://api.jquery.com/jquery.extend/ for a detailed explaination.
It is mentionable though that when preforming the second extension jQuery will prepend the old value of test to the array, thats why I added

o1.test = o1.test[0];

Post a Comment for "Javascript, Deep Extend"