1. 数字,字符串,布尔,null, undefined 基本数据类型,传值
var a = "zhangxuchao";
var b = a;
b = "zhangxuchaoandheping";
console.log(a) "zhangxuchao";
console.log(b) "zhangxuchaoandheping";
2. 对象,数组,函数引用数据类型,传址
var a=[1,3,4];
var b=a;
a[0]=99;
console.log(a); [99, 3, 4]
console.log(b); [99, 3, 4]
网友评论