Instruction: Explain the concept of memory leaks in JavaScript and how they are dealt with.
Context: This question tests the candidate's knowledge of memory management and garbage collection in JavaScript.
medium