Create a shallow-copied clone of the object. Any nested objects or arrays will be copied by reference, not duplicated.
创建对象的浅拷贝克隆.如果是值类型,则拷贝值;如果是引用类型,则拷贝引用地址。
1 _.clone({name : 'moe'}); 2 => {name : 'moe'};
源码:
1 _.clone = function(obj) { 2 if (!_.isObject(obj)) return obj; 3 return _.isArray(obj) ? obj.slice() : _.extend({}, obj); 4 };