# Help with Sleep Debt Calculator

Hi everybody! I was doing this project and after receiving this error I went through the walk through and the hints and I can’t find what I am doing wrong. When I run this code it gives me an error message of actualSleepHours is not defined, when I clearly define it in the code. Thank you so much for your help

const getSleepHours = day => {
if(day === ‘monday’){
return 8;
}
else if(day === ‘tuesday’){
return 9;
}
else if(day === ‘wednesday’){
return 10;
}
else if(day === ‘thursday’){
return 10;
}
else if(day === ‘friday’){
return 2;
}
else if(day === ‘saturday’){
return 9;
}
else if(day === ‘sunday’){
return 23;
}
}

const getActualSleepHours = () =>
getSleepHours(‘monday’) + getSleepHours(‘tuesday’) +
getSleepHours(‘wednesday’) +
getSleepHours(‘thursday’) +
getSleepHours(‘friday’) +
getSleepHours(‘saturday’) +
getSleepHours(‘sunday’);

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

const calculateSleepDebt =() => {
const actualSleepHours = getActualSleepHours();
const idealSleepHours = getIdealSleepHours();
};
if(actualSleepHours === idealSleepHours){
console.log(‘Holy Cow! You are really good at sleeping!’);
}
if(actualSleepHours < idealSleepHours){
console.log(‘You missed lots of sleep’);
}

Just here, you’ve actually accidentally closed the `calculateSleepDebt` function right after declaring the variables, so the if statements below can’t actually access them. move the if statements inside the function and that should solve that issue.