Console.log not working

hello, still working at the same project sleep debt.

Now my code at the end do not console.log the ideal sleephours. Can please someone tell me why :confused:

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

case "tuesday":
  return 7;
  break;

case "wensday":
  return 6;
  break;

case "thursday":
  return 8;
  break;

case "friday":
  return 8;
  break;

case "saturday":
  return 8;
  break;

case "sunday":
  return 8;
  break;

default:
  return "eror";

}
};

const getActualSleepHours = () =>
getSleepHours(“monday”) +
getSleepHours(“tuesday”) +
getSleepHours(“wensday”) +
getSleepHours(“thursday”) +
getSleepHours(“friday”) +
getSleepHours(“saturday”) +
getSleepHours(“sunday”);

const getIdealSleepHours = () => {
const idealHours = 8 ;
return idealHours * 7;
};

console.log(getIdealSleepHours());

Hi, the functions look good. But please check the double quotes used. For example in getActualSleepHours() its “monday”. But it should be 'monday' or "monday". Same in getSleepHours.

But that could also be due to the formatting here in the forum …

Otherwise your code works for me.

1 Like

hey thank you! Actually it was the web editior wich didnt had a conection.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.