jQuery Deep/Recursive Copy using $.extend
<p>I am trying to merge two objects using jQuery $.extend. </p>

<p>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?</p>

<pre><code> $(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);


    });
</code></pre>

<p>EDIT: I referred</p>

<p><a href="http://stackoverflow.com/questions/565430/deep-copying-an-array-using-jquery">(Deep) copying an array using jQuery</a></p>
