Function defined by variable

Sorry if this sounds too beginner but here is my question .
I was learning game dev from mdn docs.

https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Game_over

and we had a function setInterval(draw,100)
and there they replaced this with var interval = setInterval(draw,100) but they didnt call the function after storing it in variable. I think they should do something like this interval(); But they never even called the function but the function is running ,how can so be . variable should only define function isn’t it. how come it execute that setInterval() .

This is the call to the function setInterval. The result of the function call (not the function itself) is assigned to the variable named interval.

1 Like

then how can we assign the function itself to the variable

Call the function and then assing it?