Sleep Debt Calculator Step 10

i am doing the sleep debt calculator project. []

I am having trouble doing step 10 of the project. my code reads as this, and before you ask no, i dont know how to use githhub

const calculateSleepDebt = () => {

const actualSleepHours =


const idealSleepHours =


if (actualSleepHours === idealSleepHours) {

console.log(“You got perfect sleep!”);

} else if (actualSleepHours > idealSleepHours) {

console.log('You got' + (idealSleepHours + actualSleepHours) + 'hour(s) more than you need. You overslept.');

} else if (actualSleepHours < idealSleepHours) {

console.log ('You got' + (idealSleepHours - actualSleepHours) + 'hour(s) less than you need. Start going to bed');

} else {
console.log(“Error! Please check your code!”);

the error i get is this,


ReferenceError: calculcateSleepDebt is not defined
at Object. (/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/sleepDebtCalculator.js:63:1)
at Module._compile (module.js:571:32)
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)
at bootstrap_node.js:542:3

Now i have gone over the calculateSleepDebt function several times, and I cannot figure it out. the help video provided is useless and this is the first time that the help video has failed me.

Hi @codemasterzk72
welcome to the forum!
Look what the error message is. It tells you exactly what it cannot find:

Now search for exactly this: calculcateSleepDebt in your code and compare it with your function definitions.

Thanks. Now another question I accidentally deleted my project file after trying to delete a duplicate file and now the exercise won’t work properly. What do I do. I can’t progress until this is fixed.

Do you know which file you deleted?

Yes. It was in Unit 3:


Basically the file my project was in and I can’t get the exercise to work properly now. Even when I try to start fresh it’s not saving.

So you successfully saved a new file named sleepDebtCalculator.js in the directory Unit_3, but you can’t save anymore? I never deleted a file from the codecademy folder, so I don’t know if you can restore that. So all I can suggest is that you doublecheck the directory, the file name and your code. Good luck!

Yeah. Looks like I’m skipping this lesson then. Thanks for the help you did offer though.

Fortunately, I understand what I was creating and what I was doing wrong. I’m just annoyed I can’t see it work in action now. There should be an undo for deletes so it doesn’t mess up your project space. Oh well.

Um break that down for me. I just started so I’m not well versed.

Solved it thanks for everyone’s help

1 Like

Congrats! How did you solve it?

I just started over. From the top. I woke up the next day and my workspace was back.

1 Like