Pergunta de entrevista da empresa Capgemini

What is a closure in JavaScript, and how is it useful?

Resposta da entrevista

Sigiloso

10 de jul. de 2025

I explained closures with an example where a function remembers the variable from its parent scope. I also gave a use case using counters and private variables.