Sleep debt calculator

Not sure if I’m asking this in the proper way but I will learn. Anyway I keep getting error message that “actualSleepHours” is not defined and I can’t figure it out. This is the Sleep Debt Calculator exercise in JavaScript lesson

Hello @blazer125.

Welcome to the forums.

Your issue is one of scope. You are attempting to access variables that have been declared inside of a function from outside of the function:

For reference, here is a link to the exercise.

1 Like

Dang it! It’s just like walking up and down the aisle for 20 minutes at the grocery store looking for a specific bag of candy your kid wanted and giving up then asking someone and they go right to it right in front of you.

I did try for quite some time to do it on my own. Thank you so much for stating the obvious!


This ought to be on a t-shirt, it’s the definition of coding