DEV Community

loading...

Discussion on: Basic JavaScript Interview Questions

Collapse
piotrlewandowski profile image
Piotr Lewandowski

"Closure is not necessarily a function, it can be any data type" not, exactly. According to MDN: "A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment)." (source: developer.mozilla.org/en-US/docs/W...)

Collapse
grglldz profile image
Guiorgui

That is not wrong. That's just one aspect of closures.

Thread Thread
piotrlewandowski profile image
Piotr Lewandowski

It's wrong when you phrase it like "JUST a reference that" ("just" suggests it's only that, not "one aspect of") when it's clearly not "just a" :) That's what I meant ;)