Error: Uncaught ReferenceError: idealHoursPerWeek is not defined on line 28


#1

I'm getting the error: ×JavaScript error: Uncaught ReferenceError: idealHoursPerWeek is not defined on line 28 when i run this code on https://js.do/ which is a JS runtime environment on the web. This is my code:

function getSleepHours(day) {
var hours = prompt('How many hours of sleep did you get on ' + day + '?');
  return Number(hours);
}

function getActualSleepHours(day) 
{
 return getSleepHours('Monday') +
  getSleepHours('Tuesday') +
   getSleepHours('Wednesday') +
   getSleepHours('Thursday') +
   getSleepHours('Friday') +
   getSleepHours('Saturday') +
  getSleepHours('Sunday');
}
 function getIdealSleepHours() {
    var idealHours = prompt('How much sleep would you prefer per night?');
    return Number(idealHours) * 7;
}
  
function calculateSleepDebt()  {
  var actualSleepHours = getActualSleepHours;
  var idealSleepHours = getIdealSleepHours;
    
}

if (idealHoursPerWeek === actualHoursPerWeek)
{
  console.log('You got the ideal amount of sleep!');
} 
else if (idealHoursPerWeek < actualHoursPerWeek) {
  console.log('You got ' + (actualHoursPerWeek - idealHoursPerWeek) + ' hours more sleep than is ideal.');
}
else 
{
  console.log('You need to get ' + (idealHoursPerWeek - actualHoursPerWeek) + ' more hours of sleep!');
 console.log('Make sure to get some rest to be your best!');
}

#2

i looked over the code where you define idealHoursPerWeek, but i don't see it anywhere? Can you tell me?


#3

The code in step 10 of the course is wrong. In all the steps up to step 10 the variable is called "actualSleepHours" ant then all of the sudden they call it "actualHoursPerWeek". Same with "idealSleepHours" and "idealHoursPerWeek"