Memory leaks can occur in JavaScript when objects are no longer needed but references to them still exist, causing performance issues and browser crashes.
Common sources of memory leaks include over-retention of object scope, leaking DOM elements, global variables, and passing whole objects when only a small part is needed.
Avoiding memory leaks involves limiting object references, using the delete operator, handling detached DOM nodes properly, managing timers and intervals, being careful with closures and callbacks, and properly removing event listeners.
Tools like Chrome DevTools can be used to detect memory leaks by analyzing memory usage, taking snapshots, and identifying high memory-consuming functions. Preventing memory leaks in JavaScript requires avoiding global variables, removing unused DOM references, handling closures and timers efficiently, and breaking object references when no longer needed.