In javascript, objects (object literals, arrays, and functions) are passed by reference. When you pass an object to a function, you are not copying it as usual in C / C ++. Instead, you pass a link (basically the middle name of the object).
function func(object) { object.changed = true; } let a = {}; func(a); console.log(a.changed);
Passing the identifier on the other hand will be much more verbose, it actually creates additional overhead, and it really depends on you how you want to develop your application.
source share