New course! Every coder should learn Generative AI!
Try a free lesson+ 3
It depends on the browser, since by default JS does not have a defined layout with respect to memory management (as far as I know)
Here you can review the specification:
https://www.ecma-international.org/ecma-262/8.0/index.html#sec-memory-model
Here is another very good article on the subject. I think this can help you a lot:
https://blog.sessionstack.com/how-javascript-works-memory-management-how-to-handle-4-common-memory-leaks-3f28b94cfbec