O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

So, what does this all mean? Well, one of the biggest ramifications is that if you change a property of the object in a function, you’re changing the property in the original object. So any changes you make to the object inside a function will still be there when the function completes. Let’s step through an example...


Cover of Head First JavaScript Programming


what are the ramifications of the pass-by-value for objects?A tip: for objects, pass-by-value means that the copy of the reference variable points to the same object and therefore any change is done on the object passed as an argument in the function will be reflected in the object. On the contrary for primitive variables, any change to the primitive variables that are passed as arguments into the functions are not reflected because these changes are temporary and last within the function only.