开发者

Javascript Array Issue

ok, so when i do array=array2 then change something in array2 it changes arra开发者_如何转开发y. how do i prevent this?


Do..

b = a.slice()

Why? Because assignment would just reference the origin object. slice or concat would create a new object.


var b = a.concat();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜