Regardless of the programming language, the memory life cycle is pretty much always the same:
The second part is explicit in all languages. The first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like JavaScript.
Visit the following resources to learn more: