Rumah >hujung hadapan web >tutorial js >值类型和引用类型区别
<script type="text/javascript"> var i = 1; var j = 2; var a = [1, 2]; function arr(b) { b[0] = 2; } function me(x, y) { x = x+y; return x; } arr(a); console.log(i); // 1 console.log(JSON.stringify(a)); // [2,2] </script>