object[property].push() vs jQuery.extend() - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:extend

Description

object[property].push() vs jQuery.extend()

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.4.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//w  w w .  j  av  a 2s .c  o  m
a={};
a['herp']=['derp'];
var b = jQuery.extend(true, {}, a);
b['herp'].push('foo');
console.log(a['herp']);
console.log(b['herp']);
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials