02. 值类型和引用类型的传递
2.值类型和引用类型的传递
//第2题 值类型和引用类型的传递 function Person(name, age, salary) { this.name = name; this.age = age; this.salary = salary; } function f1(person) { //var person = p; person.name = "ls"; person = new Person("aa", 18, 10); } var p = new Person("zs", 18, 1000); console.log(p.name);//zs f1(p); console.log(p.name);//ls