JavaScript Functions Exercise

Today has been a busy day work-wise but hey I finished 50 days of code without missing a single day… 💃🏻
It was a great learning journey and I am happy I started this. Although I am super tired at this moment but very content with the discipline and commitment 😍
Today I did another sample exercise code using Arrow Functions and Function expressions.
Exercise 01
Sleep Debt Calculator
Did you know that giraffes sleep 4.6 hours a day? We humans need more than that. If we don’t sleep enough, we accumulate sleep debt. In this project, I have created a sleep debt calculator that will calculate if I am getting enough sleep each week.
The program will determine the actual and ideal hours of sleep for each night of the last week.
Finally, it will calculate, in hours, how far I am from my weekly sleep goal.
Steps:
- To determine sleep for each day
- To calculate the sleep in a week
- Ideal Sleep hours are 7–8 hours
- Calculate sleep debt by comparing actual and ideal hours
Challenge: Ideal sleep hours can vary from person to person. Modify the function to include that.
Tomorrow I will work on the scope. Until then Happy Coding ❤
PS: If you fancy reading my 100 Days of progress, feel free to drop by ;)