Created
July 2, 2017 02:31
-
-
Save marcelitocs/3c60b87ea2fa009976a303e33d6bebfe to your computer and use it in GitHub Desktop.
extend function like $.extend
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(){ | |
for(var i=1; i<arguments.length; i++) | |
for(var key in arguments[i]) | |
if(arguments[i].hasOwnProperty(key)) | |
arguments[0][key] = arguments[i][key]; | |
return arguments[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a more complete solution, use: https://github.com/unclechu/node-deep-extend