DEV Community

Discussion on: Pass By Reference Vs Pass By Value

Collapse
 
cicirello profile image
Vincent A. Cicirello

It is still pass by value. In this case, the value passed for obj is a reference to an object, which is why the state of the object passed for obj can change. However, if you tried to do something like obj = someOtherObject inside of that function, the change is only observable inside of that function. If it was pass by reference, that change would also be observable by the caller. But it is not.