首页
IT
登录
6mi
u
盘
搜
搜 索
IT
实现JavaScript中的5种主要的数据类型(包括Number、String、Object、Array、Boolean)进行值复制
实现JavaScript中的5种主要的数据类型(包括Number、String、Object、Array、Boolean)进行值复制
xiaoxiao
2021-03-25
74
Object
.prototype.clone =
function
()
{
var
o =
this
.constructor ===
Array
? [] : {};
for
(
var
e
in
this
){ o[e] =
typeof
this
[e] ===
"object"
?
this
[e].clone() :
this
[e]; }
return
o; }
转载请注明原文地址: https://ju.6miu.com/read-15623.html
技术
最新回复
(
0
)