Javascript function execution order

javascript

Solution

It seems the confusion is this line of code

var anotherFunction = function () { isRun(true); };

This declares a variable of a function / lambda type. The lambda is declared it is not run. The code inside of it will not execute until you invoke it via the variable

anotherFunction(); // Now it runs

Problem

I am new to javascript and have a quick question. Say i have the following code: ``` function entryPoint() { callFunction(parameter); } function callFunction(parameter) { ... //do something here var anotherFunction = function () { isRun(true); }; } ``` My question is that when `callFunction(parameter)` is called, and the variable `anotherFunction` is declared, does `isRun(true)` actually execute during this instantiation? I am thinking it doesnt and the contents of the anotherFunction are only "stored" in the variable to be actually executed line by line when, somewhere down the line, the call `anotherFunction()` is made. Can anyone please clarify the function confusion?

Original source