function deepClone(origin, target) { var target = target || {}; for (var prop in origin) { if (origin.hasOwnProperty(prop)) {//判断是否是原型属性 if (typeof (origin[prop]) == 'object') {//判断是否对象 if (origin[prop] !== 'null' && Object.prototype.toString.call(origin[prop]) == '[object Array]')//判断是否是数组 target[prop] = []; else target[prop] = {}; deepClone(origin[prop], target[prop]); } else target[prop] = origin[prop]; } } return target; }