Hi
I really want to become a programmer, but this first few weeks its a struggle… if I miss one day or two, its getting hard to recover… always have to go back and start all over again. I am now on the sleep debt calculator, and I am struggling on task 2… How many hours per day, I need to put my energy onto this, how to get my muscle memory to turn on… can I have some hints please
Hey there,
I’d recommend writing some code a bit every day.
Also, feel free to take some notes and go over them before moving on to the next exercise. You can use your notes as a reminder, to keep it fresh in memory.
You don’t necessarily have to dedicate that many hours a day. Don’t burn yourself out. Just practice a couple exercises every day, whenever possible, and advance slowly. Rushing it won’t help you remember and processing all the information given in the course.
You obviously won’t be able to remember it all. Neither do I, and I’ve been at it for years. When I forget something, I usually look it up. Google is a great resource. MDN as well (look it up). Stack Overflow and Codecademy if you have any questions / uncertainties regarding your code.
Take it slow, couple exercises a day, take notes, look things up.
All the best!
Thanks for your tips. I really appreciate!
I haven’t been at it much longer than you, keeping myself on an hour a day schedule (with one or two missed days) and the most crucial thing I’ve found is to take notes constantly. Not even for the benefit of review, but the act of writing out the processes really helps with comprehending and retaining the information. What is it specifically that you’re bumping up against with sleep debt calculator?
Hi!
Thanks again for your inputs, task 2 says the function should accept a day as argument and retrun the number of hours. Using the else if
I can start it, but I am not sure what number of hours I should use for the rest of the week days, for example if monday is 8, what should be for tuesday and so on…
Ok, so thinking of this as your own personal tool to calculate your own sleep debt, think about what values you individually would need the code to reflect. Maybe you’re a light sleeper and you only get 6 hours per night, or maybe you sleep in on Wednesday so you end up with 9 or 10 hours for that night. Or, if you’re fairly consistent, you could input the same value for every day.
For this project I used a switch statement:
function getSleepHours (day) {
switch(day){
case'Sunday':
return 6;
break;
case 'Monday':
return 6.5;
break;
case 'Tuesday':
return 7;
break;
case 'Wednesday':
return 6.5;
break;
case 'Thursday':
return 5;
... etc.
The main point is that for this step, it’s up to you what values you want to use.
Ok, thanks a lot. Shall I end the switch
statement with the default:
or otherwise?
It doesn’t look like this particular project calls for it, but you could always include one for some extra practice. You could also finish your function with the original “if…else” statement you started:
function getSleepHours (day) {
if (day === 'Sunday') {
return 8;
} else if
(day === 'Monday') {
return 8;
} else if
(day ==='Tuesday')
...etc.