Earlier quoted context omitted.
When it comes to primitives you can only pass by value, but with objects and arrays you can only pass by reference . And this applies to comparisons too: when comparing objects or arrays you are comparing by reference , not deeply by their inner values. If you want to compare them deeply you have to take some additional steps to make that possible, and all of the different strategies for doing so have different trade…
but with objects and arrays you can only pass by reference. It's still pass by value, you are passing the reference of the object as a value.
let a = { foo: "bar" }
let b = { foo: "bar" }
console.log(a === b) // false
and this: let a = { foo: "bar" }
let b = a
b.foo = "blah"
console.log(a.foo) // "blah"
This is the kind of misunderstanding that causes insidious bugs.