4 ms·
> When it comes to primitives you can only pass by value, but with objects and arrays you can only pass by reference. A variable stores reference to the origin
by searchableguy 6y ago
> When it comes to primitives you can only pass by value, but with objects and arrays you can only pass by reference.
A variable stores reference to the original object and when you pass it to a function, it passes the actual reference as the value.
I think the last part you mentioned is actually confusing in js because lack of clear guidance.
isXyz, Xyz.isXyz, Object.is, and other ways are used in practice to do the same thing but they all have different behavior which trips people.