/* 值类型 */ n1 = 123; n2 = n1; //赋值 n2 = 456; alert(n1); //123; n1 != n2 /* 对象类型 */ arr1 = [123]; arr2 = arr1; //引用 arr2[0] = 456; alert(arr1[0]); //456; arr1 === arr2
/* 值类型 */ n1 = 123; n2 = n1; //赋值 n2 = 456; alert(n1); //123; n1 != n2 /* 对象类型 */ arr1 = [123]; arr2 = arr1; //引用 arr2[0] = 456; alert(arr1[0]); //456; arr1 === arr2