xxxxxxxxxx
Call by Value:
When a variable is passed to a function by value, a copy of the variable's value is made and passed to the function. Changes to the parameter within the function do not affect the original variable outside the function.
Call by Reference:
When a variable is passed to a function by reference, a reference to the original variable is passed. This means changes made to the parameter within the function directly affect the original variable outside the function.
xxxxxxxxxx
var a = {};
var func = function(b) { // callee
b.a = 1;
}
func(a); // caller
console.log(a.a); // 1