✨closure: to close over or not
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ value ⟩ function ⟩ closure ⟩ example ⟩ to close over or not❓
replit:to close over or not?
// • returns a closure
// • parameters are closed over
function GetInfo(id, name, grade) {
// ⭐ closure
// although `id`, `name`, `grade` are not mentioned explicitly,
// these parameters are still being closed over by the closure.
return function getInfo(whichValue) {
// ⭐ eval('id') returns `id`, etc ...