堆与栈

2018-07-31  本文已影响0人  陈庆香

var a = 2;

var b = a;

b = 100;

console.log('a', a);

var obj = {

a: 2,

b: 3

};

var obj2 = obj;

obj2.a = 100;

console.log('obj', obj);

var person = {

name: 'zs',

age: 18

}

function test(obj) {

// obj = person

obj.name = 'lisi';

obj = {

name: '小狗'

};

console.log('obj.name',obj.name);

console.log('person.name',person.name);

}

test(person);

console.log('name',person.name); //

上一篇下一篇

猜你喜欢

热点阅读