Values & References8 / 18
Up next

Mutation via reference

// the callee receives the same object and can mutate it
function appendZero(items: number[]): void {
  items.push(0);
}

const nums = [1, 2, 3];
appendZero(nums);
console.log(nums);
What you're solving

a function mutates the caller's object