Javascript Beginner Project Stuck in Returning Implicit return

**Hello guys I’m a newbie going I’m stuck on the Sleep Debt Calculator project after step 4 unable to call the function using implicit return **

Here is the link to the project

Snapshot code.

const getSleepHours = day => {

switch(day) {
  case 'monday':
   return 8
  case 'tuesday':
    return 7
   case 'wednesday':
    return 8
   case 'thursday':
     return 5
     case 'friday':
       return 8
     case 'saturday':
      return 7
       case 'sunday':
        return 8
         return "Error!"

const getActualSleepHours = () => 
  getSleepHours('monday') + 
  getSleepHours('tuesday') + 
  getSleepHours('wednesday') + 
  getSleepHours('thurday') + 
  getSleepHours('friday') + 
  getSleepHours('saturday') +


Please review my code any feedback is welcome. Thanks in advance!

the implicit return seems to work, i get:


as output.

seems you made a typo in one of the days. Resulting a string.

I am doing this one too. Just a question. In the instructions for the project, at this point it says define a function called ‘getActualSleepHours’. Then the example it gives, as above, is using a const not a function. i.e. I thought const was used to define a variable not a function.

Why is this? Thanks

nocolahearn, the function you see declared with const, is actually called a ‘function statement’.
It is a variant to your standard function that begins with the ‘function’ keyword.

You may need to go back to the functions section to pick up on that difference.

Ah yes! That makes sense thank you

these docs are great, as you can see there is function declaration:

function square(number) {
  return number * number;

and function expression:

const square = function(number) { return number * number }

then es6 (an update to the JS language introduced arrow function expression (docs), an example:

const square = (number) => { return number * number }

as you can see, the syntax is very similar to function expression. except that the arrow function expression allows a couple of shorthands, so we can rewrite:

const square = number => number * number

if we only have a single parameter, we are allowed to omit the brackets

when the body of our function is only a single line, we can get rid of the curly brackets and return keyword, now we have an implicit return

1 Like