Repository navigation
Murwarid Fazal - Week 3 Assignment - #14
murwaridfazal-art wants to merge 2 commits into
Conversation
RHSebregts
left a comment
There was a problem hiding this comment.
Hi!
Great work on this! I left some small comments, but functionally it's all there.
Well done!
Thank you or your work, and great luck with the rest of the course!
Best wishes,
Robbert-Jan
|
|
||
| if (normalizedSearch === '') { | ||
| return false; | ||
| } |
| return false; | ||
| } | ||
|
|
||
| return normalizedTitle.includes(normalizedSearch); |
| // Your code here | ||
| function parseDateString(dateString) { | ||
| const [format, dateValue] = dateString.split(' '); | ||
| const parts = dateValue.split('-').map(Number); |
There was a problem hiding this comment.
the .map(Number) is fancy, can you tell me how that works? How does it get the value?
| year = parts[2]; | ||
| } | ||
|
|
||
| return { day, month, year }; |
There was a problem hiding this comment.
so if my format is banana, what happens?
| } else { | ||
| console.log("Status: Hot"); | ||
| 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'll always advise that these kind of complex calculations are better off broken up over smaller bits, and shouldn't go directly into your return statement. There's a lot of components to it that could break, and it's pretty hard to figure out which part was the wrong one.
| console.log("Weather Report for " + cityName); | ||
| console.log("Temperature: " + celsius + "°C"); | ||
| console.log("Temperature: " + fahrenheit + "°F"); | ||
| console.log("Temperature: " + kelvin + "K"); | ||
| console.log("Status: " + status); | ||
| console.log("Wind chill in " + cityName + ": " + windChill.toFixed(2) + "°C"); | ||
| console.log("---"); |
There was a problem hiding this comment.
This is all correct! To make your own life a bit easier, you might want to read about Template Literals. They make it so much easier to write logs and statements like this!
No description provided.