pass by ref in javascript code example
Example: javascript pass by reference
function add(a, b, output) {
output.out = a + b;
}
var output = {};
add(5, 3, output);
console.log(output); //output: {out: 8}
function add(a, b, output) {
output.out = a + b;
}
var output = {};
add(5, 3, output);
console.log(output); //output: {out: 8}