Here's a quick demo how to use $.extend() method:
var firstName = {first: "Mickey"}, // create a first object lastName = {last: "Mouse"}; // create a second object var E = $.extend(firstName, lastName); // call extend method /* with jquery, and pass objects to be merged. First one is target,and second one is a source of properties */ dir(E); /* see new object in a chrome developer console ( or Firebug ).*/
If you want to use library outside of jquery, for a custom project you can download it here: http://underscorejs.org/
Note: you'll have to include jquery in your page, either from a local file or from CDN.
Happy Coding.
No comments:
Post a Comment