Thank you. I can see my mistake now. For some reason the function is logging “You got NaN less sleep than you wanted”. I thought I would get a number.
So the error you had is resolved? And now you have a new error/problem:
This error can happen because your provide a non-valid day. What you could do is add an else clause to getSleepHours:
} else if (day === 'sunday'){
return 8;
} else {
console.log(`${day} is not a valid day`);
}
this should help to narrow down the problem
but these thinking steps I did above, is what you should teach yourself I have been programming for 5+ years, and I still make mistakes. Being able to debug is very important
you’re welcome which is why I advising that focusing on being able to solve errors is also very important and teaching yourself these thinking steps: What could be wrong? How could I verify what could go wrong?
Not discussing personal matters out in the open on a public forum. You could send me a direct/personal messages
Please make new topics when questions arise. Then other people can also help you, you don’t want to get your advise from one person all the time. Different developers/people could lead to different answers and insights.
Don’t get me wrong, I like to answer questions, but you must not trap yourself to only rely on a single source.