Technical context:
Reading this page about how JavaScript pass Objects by sharing to functions.. Now I know an object inside the called function is the same as in the first outsider scope, unless it is directly assigned to.
This is how I could put it in words. But the example code in the page is way better and simpler.
My question is the following:
Because I'm trying to improve my calculation method, I'm having a very basic question. Is passing a smaller derived object (let's say a sub dictionary with only important keys) to a function for reading only (not to be assigned to) is better for performance (running time) ?
For sake of simplicity, here is an example
function func(){
var bigobj = {a:1, b:2, c:3, d:4};
otherFunc(bigobj.a); // will we gain some time against calling otherFunc(bigobj); ??
function otherFunc(obj){
//obj is a smaller representation of bigobj
//obj will not be assigned to here
}
}