Sleep debit calculator

Hello everyone I am trying to figure out this error message I had while doing my sleep debt calculator assignment. this is my code:

const getSleepHours = day => {
  switch(day) {
    case 'monday':
     return 8
      break;
    case 'tuesday':
      return 10
     break;
    case "wednesday":
      return 10
     break;
    case 'thursday':
      return 10
      break;
    case 'friday':
      return 4
     break;
    case 'saturday':
      return 2
     break;
    case 'sunday':
      return 12
      break;
   default:
      return "Error!"
 }
};

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


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

const calculateSleepDebt = () => {
  const actualSleepHours = getActualSleepHours();
   const idealSleepHours = getIdealSleepHours();
  
  if(actualSleepHours === idealSleepHours) 
  {
  console.log("You've got " + (idealSLeepHours - actualSleepHours) { + " more hours of sleep this week!");
}
  else if(actualSleepHours > idealSleepHours) {
  console.log("you've got more sleep needed!");
}else if(actualSleepHours < idealSleepHours) {
  console.log("you should get some rest becuase you've slept " + (idealSleepHours - actualSleepHours) + " less than you should of this week!");
 }
  else{ 
 console.log("Error! Something went wrong, check your code!")
 };
};

calculateSleepDebt();

and this is the error message I keep recieveing:

home/ccuser/workspace/javascript_101_Unit_3/Unit_3/sleepDebtCalculator.js:52
  console.log("You've got " + (idealSLeepHours - actualSleepHours) { + " more hours of sleep this week!");
                                                                 ^
SyntaxError: missing ) after argument list
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

anybody have ideas? I am all out.

1 Like

There are what look like smart quotes (or whatever they’re called) at the opening of some output statements. That may not be the problem. The { would be a problem, though.

1 Like