Sleep Debt Calculator


#1

I am hoping someone can help me with the Sleep Debt Calculator project for the learn JavaScript course (https://www.codecademy.com/courses/learn-javascript/projects/sleep-debt-calculator). I have been struggling with this for a while. No matter what hours I enter in, the console log always returns with "Ouch. Looks like you missed your sleep goal by NaN hours."

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

function getActualSleepHours() {
  return getSleepHours('Monday') + 
    getSleepHours('Tuesday') + 
    getSleepHours('Wednesday') + 
    getSleepHours('Thursday') + 
    getSleepHours('Friday') + 
    getSleepHours('Saturday') + 
    getSleepHours('Sunday');
}

function getIdealSleepHours () {
  var ideal = prompt('How many hours of sleep is ideal for you?');
  return Number(ideal) * 7;
}

function calculateSleepDebt () {
  var actualSleepHours = getActualSleepHours;
  var idealSleepHours = getIdealSleepHours;
  if (actualSleepHours === idealSleepHours) {
    return console.log('Congrats!  You reached your sleep goal for the week.');
  }
  if (actualSleepHours > idealSleepHours) {
    return console.log('It looks like you slept ' + (actualSleepHours - idealSleepHours) + ' hours more than you needed.');
  }
  if (actualSleepHours < idealSleepHours) {
    return console.log('Ouch.  Looks like you missed your sleep goal by ' + (idealSleepHours - actualSleepHours) + ' hours.');
  }
}

getActualSleepHours ();
getIdealSleepHours ();
calculateSleepDebt ();

#2

I got this figured out. I asked an adviser within the course and got the answer. Basically I wasn't calling the functions correctly within the calculateSleepDept function

This

function calculateSleepDebt () {
  var actualSleepHours = getActualSleepHours;
  var idealSleepHours = getIdealSleepHours;

Should have been this

function calculateSleepDebt () {
  var actualSleepHours = getActualSleepHours();
  var idealSleepHours = getIdealSleepHours();

Forgot the ().
Also calling those functions at the end is not needed. Just need the calculateSleepDebt one. I am not sure how to delete this post or lock it.