Sleep Debt Calculator Why do we put const in with functions? Shouldn't functions be given a name a condition and a code of block to run only?

Link to what I am working on:

On step 4 the instructions state:

Now that you’ve written a function to get the sleep hours for each night, we need to do three things:

Get the total sleep hours that you actually slept
Get the ideal sleep hours that you prefer
Calculate the sleep debt, if any.
To get the total sleep hours that you actually slept, create a new function named getActualSleepHours that takes no parameters.


const getSleepHours = day => {
const getActualSleepHours = () => {

I noticed that const is used normally to create a variable. Do we need to have const included? I thought functions were named and run. I do not understand why we put const there.

To put it simply, you are basically creating a variable to work as a function. so instead of doing

function test(){}

and then calling it.

You declare a variable that has to work as a function.

Arrow functions are preferable as they are concise, and easy to understand, and worked on.