Last active
August 29, 2015 14:20
-
-
Save filippomangione/57e70c8d55b9aca8eaea to your computer and use it in GitHub Desktop.
Extending objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extend() { | |
var args = Array.prototype.slice.call(arguments); | |
for(var i=1; i<args.length; i++) { | |
for(var key in args[i]) { | |
if(args[i].hasOwnProperty(key)) { | |
args[0][key] = args[i][key]; | |
} | |
} | |
} | |
return args[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment