var a = 20;
var b = a;
console.log(a); //20
console.log(b); //20
console.log(a === b); //true
a = 30;
console.log(a); //30
console.log(b); //20
var user = {
name: 'John',
age: 35
}
var user2 = user;
console.log(user); //{name: "John", age: 35}
console.log(user2); //{name: "John", age: 35}
console.log(user === user2); //true
user2.name = 'Jay';
console.log(user); //{name: "Jay", age: 35}
console.log(user2); //{name: "Jay", age: 35}
user2 = {
name: 'Jay',
age: 35
}
console.log(user); //{name: "Jay", age: 35}
console.log(user2); //{name: "Jay", age: 35}
console.log(user === user2); //false
user2.name = 'Jason';
console.log(user); //{name: "Jay", age: 35}
console.log(user2); //{name: "Jason", age: 35}