1) Why is obj1 value not the same as copyObj1, although copyObj1 is a reference of obj1?
Answer: -
You are storing the reference of obj1 to copyObj1.But this statement
copyObj1 = {
name: 'abc'
};
creates a new object of copy1 and the reference to obj1 is now lost.
2) What is the difference if we assign value by {name:'abc'} and obj1.name ='abc'?
Answer:-
The difference between the two is when you do
a = {name: 'abc'} or a = {};
you are creating a new object and any previous reference of the object is now lost and doing
a.name = 'abc';
just changes the property value of the object.