Home >Web Front-end >JS Tutorial >The difference between value types and reference types
<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>