What is the difference between primitives and objects?
Primitives — strings, numbers, booleans, null, undefined, symbols, bigints — are copied by value. Objects, including arrays and functions, are copied by reference, so two variables can point at the same thing and changing it through one is visible through the other. Almost every 'why did my array change' bug is this.