Repository navigation
Conversation
RHSebregts
left a comment
There was a problem hiding this comment.
Hi!
Great work, with some really nice code and concepts implemented. Well done!
I left some comments, but functionally you're all there!
Thank you for your work, and the best of luck with the rest of the course!
Best wishes,
Robbert-Jan
| return { day: second, month: first, year: year }; | ||
| } | ||
|
|
||
| return { day: first, month: second, year: year }; |
There was a problem hiding this comment.
So what do we do when we get a different (nonsensical) value for format?
| function getTemperatureStatus(celsius) { | ||
| if (celsius < 0) { | ||
| return "Freezing"; | ||
| } | ||
| if (celsius < 10) { | ||
| return "Cold"; | ||
| } | ||
| if (celsius < 20) { | ||
| return "Mild"; | ||
| } | ||
| if (celsius < 30) { | ||
| return "Warm"; | ||
| } | ||
| return "Hot"; | ||
| } |
There was a problem hiding this comment.
Early returns, and no else, love it!
| function printWeatherReport(cityName, celsius) { | ||
| console.log("Weather Report for " + cityName); | ||
| console.log("Temperature: " + celsius + "°C"); | ||
| console.log("Temperature: " + celsiusToFahrenheit(celsius) + "°F"); | ||
| console.log("Temperature: " + celsiusToKelvin(celsius) + "K"); | ||
| console.log("Status: " + getTemperatureStatus(celsius)); | ||
| console.log("---"); | ||
| } |
There was a problem hiding this comment.
This is good, but to make it easier on yourself to write these strings, I'd advise you to read about Template Literals.
|
|
||
| // Wind chill formula | ||
| function calculateWindChill(celsius, windSpeed) { | ||
| return 13.12 + 0.6215 * celsius - 11.37 * Math.pow(windSpeed, 0.16) + 0.3965 * celsius * Math.pow(windSpeed, 0.16); |
There was a problem hiding this comment.
I always advise against having these relatively complex calculations in a return. It is easier to trouble shoot if you break it up somehow. But for now it's ok!
Week 3 assignment
Task 1: isBookApplicable function (case-insensitive search, handles extra spaces)
Task 2: parseDateString function (supports MDY and DMY formats)
Task 3: date.js module with 6 time conversion functions
Task 4: refactored cleanup.js using functions (DRY)
Bonus: added weather reports for Shiraz, Tehran, New York and Boston