TIL that JavaScript primitives are passed by value whereas objects and arrays are passed by reference. So a = 1 will always be 1 if you pass it to a function, but a = { value: 1 } can be updated. I don't often have to track state in vanilla JS, so this just somehow never came up before!
0 reposts0 likes