I recently interviewed a candidate for an entry level web developer position and asked this question: What might you call the following line of code in Javascript:
let foo = function() {}
The question was purposefully vague because the resume was weak and I wanted to get a sense of how the candidate worked through all of the possible answers to the question. After a few moments the response was essentially "I don't know, what's the right answer?"
I explained that there are a few answers: Variable declaration, function assignment, hoisting mitigation, ES6, etc. Then I said it could also be considered a closure. To that, the candidate responded, "I don't think that's a closure. A closure is a function inside of function."
It's the first time I've ever had a candidate challenge my response to a question to which they didn't know the answer and it made me wonder if a closure could be boiled down to a simple one liner. Am I wrong about that?
Edit: This is only for my own learning and has nothing to do with the candidate. In fact, we extended an offer and they accepted. They start next week :)