Pregunta de entrevista de Salesforce

How does garbage collection work in Javascript?