var a = { name: '小明' } var b = cloneObj(a); alert(b.name); //'小明' function cloneObj(obj){ var F = function(){}; F.prototype = obj; return new F(); }
var a = { name: '小明' } var b = cloneObj(a); alert(b.name); //'小明' function cloneObj(obj){ var F = function(){}; F.prototype = obj; return new F(); }
转载于:https://www.cnblogs.com/chenzhiyu/p/8820420.html