JavaScript under the hood
Garbage Collection
JS is a garbage collected language, meaning you don't have to manually manage memory in a JS application.
However, it often misses performance benefits of eager garbage collection because there is no possible algorithm to decide whether or not you can garbage collect a variable.
JS just runs the garbage collector periodically to see if a value isn't being used. All local variables in a function are automatically cleaned up once the function finishes executing.