The major difference between primitives and Objects is that variables containing primitives hold the data inside of the variable itself.
In case of objects, this is not the case. Variable associated with objects, do not actually contain the object but instead they contain reference to a place in memory where the object is stored.
Let’s have a look at this practically
For Primitives
For Objects
Let’s have a look in case of functions