Of course they are different:
https://docs.angularjs.org/api/ng/function/angular.copy[
^].
The result of this function is a
deep copy of the original object. They are
referentually different, because the two objects will exist as independent objects which reside in different fragments of memory. If you modify any property of any of the objects in the
object graph referenced by either source or resulting reference, the other object will remain intact.
This is not what happens if you simply assign one object to another. Consider this:
var a = {a:1, b:2, c:3}
var b = a
b.a = 13
Compare it with
var a = {a:1, b:2, c:3}
var b = {}
b.a = a.a; b.b = a.b; b.c = a.c;
b.a = 13
Understanding of reference and value objects lie in the very heart of general programming. You need to understand such things perfectly, to do nearly any kind of programming.
I used an example where deep copy is no different from
shallow copy. Deep copy is needed when element of some objects are also some non-primitive objects, and so on. Shallow copy keeps the referentially identical properties, and deep copy clones all objects of all properties recursively.
—SA