JavaSccript Functions vs Variables


When taking on of the Quizzes on JavaScript Scope, I was asked this question:

Wouldn’t ‘multiplier’ be a function here, not a variable.

If I am misunderstanding something obvious, please tell me the difference.


its both, the variable contains a function. input and controlVal have integer values, multiplier has a function “value”.


Variables are not containers, only labels we give to an object. multiplier is indeed a variable, but it is not a function. The object it is associated with (references) is the function.


What @mtf says might seem nitpicky, but it’s not at all so

let a = 1

When a is said to be a Number, or 1, that is an intentional simplification in favour of brevity. It may be saner to speak in plain English, to focus on what is actually being said rather than being perfectly accurate about what everyone’s already assumed to know.