Cannot get arguments to add together - sleep debt calculator

I am working through the sleep debt calculator project and am totally stuck as to why my function getActualSleepHours isn’t adding my sleep it is instead just writing them concurrently?

e.g. 8575496 insead of 44

here is my code:

const getSleepHours = (day) => {
switch (day) {
case “Monday”:
return “8”;
break;

case "Tuesday":
  return "5";
  break;

case "Wednesday":
  return "7";
  break;

case "Thursday":
  return "4";
  break;

case "Friday":
  return "5";
  break;

case "Saturday":
  return "6";
  break;

case "Sunday":
  return "9";
  break;

default:
  return "Error!!";

}
};

const getActualSleepHours = () =>
getSleepHours(“Monday”)+
getSleepHours(“Tuesday”)+
getSleepHours(“Wednesday”)+
getSleepHours(“Thursday”)+
getSleepHours(“Friday”)+
getSleepHours(“Saturday”)+
getSleepHours(“Sunday”);

console.log(getActualSleepHours());

because you are returning strings instead of a number value. Also for case statements you don’t need break after a return. It creates unreachable code, so this

case "Sunday":
  return "9";
  break;

should just be

case "Sunday":
  return "9";
1 Like

Thankyou so much.

new code works

const getSleepHours = (day) => {
switch (day) {
case “Monday”:
return 8;

case "Tuesday":
  return 5;

case "Wednesday":
  return 7;

case "Thursday":
  return 4;

case "Friday":
  return 5;

case "Saturday":
  return 6;

case "Sunday":
  return 9;

default:
  return "Error!!";

}
};

const getActualSleepHours = () =>
getSleepHours(“Monday”) +
getSleepHours(“Tuesday”) +
getSleepHours(“Wednesday”) +
getSleepHours(“Thursday”) +
getSleepHours(“Friday”) +
getSleepHours(“Saturday”) +
getSleepHours(“Sunday”);

console.log(getActualSleepHours());