Javascript copy by reference

With a = {}; b = a, you get

quoted from stackoverflow:

No, JS doesn’t have pointers.

Objects are passed around by passing a copy of a reference. The programmer cannot access any C-like “value” representing the address of the object.

Within a function one may change the contents of an passed object via that reference, but you cannot modify the reference that the caller had, because your reference is only a copy:

Pictorial

js_ref_1_2

js_ref_3

js_ref_4_5