I'm beginner in web frontend development. I have some questions, and one of them is whether hoisting in JavaScript has to do with spatial locality for memory optimization. The reason I thought so was as follows.
JavaScript seems to follow call-by-reference except for primitive types. And, in the process of allocating memory for variables in JavaScript, keywords(var, let, const) are found and memory is allocated for references first.
So, I thought of this as putting the addresses of references on the same page as much as possible. I'm curious if anyone knows about this or what other people think. Thank you for reading my question :)