Calling getActualSleepHours lists the hours, doesnt add


#1

project url: https://www.codecademy.com/courses/learn-javascript-functions/projects/sleep-debt-calculator?course_redirect=introduction-to-javascript

Hello- When I try to call the getActualSleepHours it lists the hours for each day from getSleepHours instead of adding them- not sure what I’m missing.

function getSleepHours (day) {
  switch (day) {
    case 'Monday':
      console.log(8);
      break;
    case 'Tuesday':
      console.log(7);
      break;
    case 'Wednesday':
      console.log(8);
      break;
    case 'Thursday':
      console.log(6);
      break;
    case 'Friday':
      console.log(6);
      break;
    case 'Saturday':
      console.log(8);
      break;
    case 'Sunday':
      console.log(9);
      break;
    default: 'invaild item';
      break;
      
  }
}
const getActualSleepHours = () => {
		getSleepHours('Monday') +
     getSleepHours('Tuesday') +
      getSleepHours('Wednesday') +
      getSleepHours('Thursday') +
      getSleepHours('Friday') +
      getSleepHours('Saturday') +
      getSleepHours('Sunday'); 
}

console.log(getActualSleepHours());

#2

step 2 of the project instructions:

For instance, if you got 8 hours of sleep on Monday night, calling getSleepHours('monday') should return 8

there is a very important word in that sentence that you missed: return

as for you getActualSleepHours function, same issue, while its even more clearly mentioned in the instructions:

Add the results together and return the sum using an implicit return


#3

Ah I see, I saw that it needed to print to the console and thought console.log -
thanks


#4

the final result should be printed/logged which you do fine:

console.log(getActualSleepHours());

but in programming, there is often more logic then interaction with the user by I/O (input/output)