underscore.js _.extend[Object]
2012-04-16 21:42
405 查看
Copy all of the properties in the source objects over to the destination object, and return the destination object. It's in-order, so the last source will override properties of the same name in previous arguments.
将源对象属性复制到目标对象,并返回目标对象。它是有序的,所以最后的来源将覆盖以前参数名称相同的属性。
源码:
将源对象属性复制到目标对象,并返回目标对象。它是有序的,所以最后的来源将覆盖以前参数名称相同的属性。
_.extend({name : 'moe'}, {age : 50}); => {name : 'moe', age : 50}
源码:
_.extend = function(obj) { each(slice.call(arguments, 1), function(source) { for (var prop in source) { obj[prop] = source[prop]; } }); return obj; };
相关文章推荐
- underscore.js _has[Object]
- underscore.js _.isRegExp[Object]
- underscore.js _.isEqual[Object]
- underscore.js _.isNaN[Object]
- underscore.js _.isNull[Object]
- underscore.js _.isEmpty(Object)
- underscore.js _.isElement(Object)
- underscore.js _isUndefined[Object]
- underscore.js _.isArray(Object)
- underscore.js _.isObject[Object]
- underscore.js _.keys[Object]
- underscore.js _.isArguments[Object]
- underscore.js _.values[Object]
- underscore.js _isFunction[Object]
- underscore.js_.functions[Object]
- underscore.js _.isString[Object]
- underscore.js _.isNumber[Object]
- underscore.js _.pick[Object]
- underscore.js _.finite[Object]
- underscore.js _.clone[Object]