I am trying to merge two objects using jQuery $.extend.
Using the following code, I am trying to alert ( “Ball – Stump - Umpire”). But the current output is ( “Undefined – Stump - Umpire”). It does not achieve the deep (recursive) copy. How do we correct this?
$(document).ready(function () { debugger; //$.extend var obj3 = { throwable: { text1: 'Ball' }, text3: 'Umpire' }; var obj4 = { throwable: { text4: 'Bat' }, text2: 'Stump' } //Simple Copy var result1 = $.extend(obj3, obj4); //alert(result1.throwable.text4 + " - " + result1.text2 + " - " + result1.text3); //Deep Copy //First parameter is passed as Boolean true to accomplish deep (recursive) copy var result2 = $.extend(true, obj3, obj4); alert(result2.throwable.text1 + " - " + result2.text2 + " - " + result2.text3); }); EDIT: I referred
asp.net.netjquery-uijquery-pluginstags related to the question?