Javascript Object extend(destination, source)
Object.extend = function(destination, source) { for (var property in source) { if (source.hasOwnProperty(property)) { destination[property] = source[property]; }/*from ww w . j a v a 2s . c o m*/ } return destination; };