Stuck and unsolved

const getSleepHours = day => {
switch (day){
case ‘monday’:
return 8;
break;
case ‘tuesday’:
return 7;
break;
case ‘wednesday’:
return 6;
break;
case ‘thursday’:
return 8;
break;
case ‘friday’:
return 6;
break;
case’saturday’:
return 9;
break;
case ‘sunday’:
return 8;
break;
default:
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(‘monday’));

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

const calculateSleepDebt = () => {
const actualSleepHours = getActualSleepHours();
const idealSleepHours = getIdealSleephours();
if(actualSleepHours === idealSleepHours){
console.log (‘User got perfect amount of sleep’)
}
else if(actualSleepHours > idealSleepHours){
console.log (‘User got more sleep than needed’)
}
else if(actualSleepHours < idealSleepHours){
console.log(‘User should get some rest’)
}
else {
console.log(‘error! , invalid input’)
}
};

calculateSleepDebt();

After run calculateSleepDebt(): error shows getIdealSleepHours is not definedsomeone please help

Hello!
getIdealSleepHours is defined
getIdealSleephours isn’t defined

hope that helps

1 Like