How does JavaScript handle memory management?
JS manages memory via automatic garbage collection.
Memory allocation happens when objects are created, and deallocation occurs when they’re
no longer reachable.
Example:
Creating large arrays without clearing references may cause memory leaks.