Repository navigation
Hassan A. - #4
ElevenEight118 wants to merge 4 commits into
Conversation
RHSebregts
left a comment
There was a problem hiding this comment.
Hi!
Overall good work on these tasks. Task 2 needs some real attention, the rest is pretty good as is!
Thank you for your efforts, and all the best of luck the rest of the course!
Best wishes,
Robbert-Jan
| function isBookApplicable(searchString) { | ||
| // Your code here | ||
| const bookTitle = "The fundamentals of JavaScript"; | ||
| const isApplicable = bookTitle.toLowerCase().includes(searchString.toLowerCase().trim()) |
There was a problem hiding this comment.
A super tiny nitpick here would be that since we know we always want the book title lowercased, we might as well just save the const already lowercased. That way you don't have to run the .toLowercase() on that const every time you run the function.
| year: dateValue[2] | ||
| } | ||
|
|
||
| } else { |
There was a problem hiding this comment.
This else is too loose, we can also enter banana as a date format. If you just add another if and a return in the end, you'd not even need the else!
| Number(dateValue[0]); | ||
| Number(dateValue[1]); | ||
| Number(dateValue[2]); |
There was a problem hiding this comment.
The returned values are still strings, not numbers, so this needs an extra step.
| // Your code here | ||
| function parseDateString(dateString) { | ||
|
|
||
| const parts = dateString.split(" ") |
There was a problem hiding this comment.
Please use a more specific name, now it's a bit of guess what these parts are a part of.
There was a problem hiding this comment.
In my testing I could give values that don't make sense at all, and still get a response. It might be nice to look into some sort of check on that, so that we can't have banana-apple-pear as a date.
| let tempFahrenheit = (tempCelsius * 9 / 5) + 32; | ||
| let tempKelvin = tempCelsius + 273.15; | ||
| console.log(`Weather Report for ${cityName}`) | ||
| console.log(`Temperature: ${tempCelsius}`) | ||
| console.log(`Temperature: ${tempFahrenheit}`) | ||
| console.log(`Temperature: ${tempKelvin}`) | ||
| if (tempCelsius < 0) { | ||
| console.log("Status: Freezing"); | ||
| } else if (tempCelsius >= 0 && tempCelsius < 10) { | ||
| console.log("Status: Cold"); | ||
| } else if (tempCelsius >= 10 && tempCelsius < 20) { | ||
| console.log("Status: Mild"); | ||
| } else if (tempCelsius >= 20 && tempCelsius < 30) { | ||
| console.log("Status: Warm"); | ||
| } else { | ||
| console.log("Status: Hot"); | ||
| } |
There was a problem hiding this comment.
Please add some spaces to this, to give a visual separation of code. This improves readability.
No description provided.