首页 > 代码库 > js 数组赋值问题 :值传递还是引用?

js 数组赋值问题 :值传递还是引用?

var a = [1,2,3];var b = a;a = [4,5,6];alert(b);  //[1,2,3]

===========================================

var a = [1,2,3];var b = a;a.pop();alert(b);  //[1,2]

 

 

技术分享

js 数组赋值问题 :值传递还是引用?