标签:function ret isa const 深度 active java color eof
/** * * @param obj * @returns {*} */ //深度克隆 function cloneObject(obj) { if (obj === null || typeof(obj) !== ‘object‘ || ‘isActiveClone‘ in obj) return obj; if (obj instanceof Date) var temp = new obj.constructor(); //or new Date(obj); else var temp = obj.constructor(); for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { obj[‘isActiveClone‘] = null; temp[key] = cloneObject(obj[key]); delete obj[‘isActiveClone‘]; } } return temp; }
技术交流QQ群:15129679
标签:function ret isa const 深度 active java color eof
原文地址:http://www.cnblogs.com/yeminglong/p/6104459.html