Sleep Debt Calculator -Stuck on Step 4

Hello All - I am getting an error from the below code, I think the issue is the else if for Wednesday. The error is 8
15error6489

Code …

const getSleepHours = day => {
if (day === ‘monday’) {
return 8;
} else if (day === ‘tuesday’) {
return 7;
} else if (day === ‘wednesay’) {
return 4;
} else if (day === ‘thursday’) {
return 6;
} else if(day === ‘friday’) {
return 4;
} else if (day === ‘saturday’) {
return 8;
} else if (day === ‘sunday’) {
return 9;
} else {
return ‘error’;
}
};
const getActualSleepHours = () =>
getSleepHours(‘monday’) + getSleepHours(‘tuesday’) + getSleepHours(‘wednesday’) + getSleepHours(‘thursday’) + getSleepHours(‘friday’) + getSleepHours(‘saturday’) +getSleepHours(‘sunday’);

console.log(getSleepHours(‘monday’));
console.log(getActualSleepHours());

1 Like

You have ‘wednesday’ misspelled. That may be it.

1 Like

Ha…Thank you.all set.

1 Like