Https://www.codecademy.com/courses/learn-javascript/lessons/scope/exercises/functional-scope?action=lesson_resume


#1

https://www.codecademy.com/courses/learn-javascript/lessons/scope/exercises/functional-scope?action=lesson_resume

can't understand this.


#2

Could you please explain what exactly you can't understand?


#3

I don’t understand either and will try to explain.

In the lesson we have learned about variables and functions.
But now all of a sudden it says (when code is revealed), on line 4: "var myApartment = function() {"
The combination of variable and function is new.
We were told to put a variable inside of a function (which i did, and in the revealed code it’s on lines 5 and 6). We weren’t told to put a function inside a variable, which is what seems to be happening on line 4.
Apparantly a whole function can be made to be the value of a variable.
But why? And why is this not properly explained?