1.值传递
<script>
var a = 1;
var b = 2;
function changeA(a,b){
var tmp = a;
a = b;
b = tmp;
}
changeA(a,b);
console.log(a,b);
</script>
2.引用传递 function 和 Object
<script>
//Array 是Object
var a = [1,2];
function changeB(a){
var tmp = a[0];
a[0] = a[1];
a[1] = tmp;
}
changeB(a);
console.log(a);
</script>