Last active
August 29, 2015 14:07
-
-
Save yanhaijing/98a9dec3626e6558b6c5 to your computer and use it in GitHub Desktop.
浅拷贝扩展
This file contains 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 target = arguments[0] || {}; | |
var arrs = slice.call(arguments, 1); | |
var len = arrs.length; | |
for (var i = 0; i < len; i++) { | |
var arr = arrs[i]; | |
for (var name in arr) { | |
target[name] = arr[name]; | |
} | |
} | |
return target; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment