Sleep Debt calculator

Not so much a problem doing the exercise more like confusion about how this would actually work in the real world. When asked to write else/if or a switch statement for each day of the week, I scratched my head for quite a while thinking how do I get the information from the user into the sleep debt calculator. Only after looking at the walkthrough video did I realise we are supposed to make it up and enter the hours while creating the program. Does that seem somewhat odd to anyone else? Maybe I am missing the point.

The idea for this part of the course is to teach you Javascript and the syntax thereof. Javascript is generally used to make dynamic webpages, and so the idea is that practically, this code would take input via a webpage of some sort which this script is linked to. However currently it’s just trying to teach you how Javascript works, and then if you take the Web Development path it will show you how to manipulate inputs received from the webpage using JS.

It’s great that you’re already thinking about that kind of thing though, as it shows your beginning to think about the problem to be solved, more than just completing the exercises for their own sake.


I have a habit of over thinking things, I think that’s what I have done here, as you say, not necessarily a bad thing, but in this case I understand it’s just a vehicle to teach me the basic syntax rather than a real world example.

I’ll try to jeep that in mind as I continue. Thanks Adam.

1 Like

If you’re interested then it can be good for you to keep this noted, and if you go further in web development you can add this to your webpage with the ability to take user input and alter the page based on the response! It’s a good personal exercise to give yourself.

Seeing this gave me immense satisfaction.


1 Like