-
Notifications
You must be signed in to change notification settings - Fork 18
Mustafa Homsi #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
remarcmij
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @homsi6313-art, thanks for submitting your assignment. I have some minor comments but will approve your PR now,
| const cleanTitle = isBookTitle.toLowerCase(); | ||
|
|
||
| return cleanTitle.includes(cleanSearchString); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but it would be easier to check if you included the code to run the tests.
| } | |
| } | |
| console.log(isBookApplicable('javascript')); | |
| // Output: true | |
| console.log(isBookApplicable('javascript ')); | |
| // Output: true | |
| console.log(isBookApplicable('python')); | |
| // Output: false | |
| console.log(isBookApplicable('JavaScript')); | |
| // Output: true | |
| console.log(isBookApplicable('JAVASCRIPT')); | |
| // Output: true | |
| function parseDateString(dateString) { | ||
| const trimmed = dateString.trim(); | ||
|
|
||
| const parts = trimmed.split(/\s+/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regular expression matches one or more whitespace characters (spaces, tabs). If this is how you understand it too, then this is an excellent choice. However, I would have accepted a space constant as a separator too here.
| const parts = trimmed.split(/\s+/); | |
| const parts = trimmed.split(' '); |
| return { day, month, year,}; | ||
| } | ||
|
|
||
| const day = Number(first); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are assuming here that if it is not MDY, it must be DMY. That happens to be the case in the example console.logs. Maybe you could return an error message when it is not DMY so that it prints with the console.log?
| export function convertHoursToMinutes(hours) { | ||
| return hours * 60; | ||
| } | ||
| export function convertMinutesToHours(minutes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a best practice to separate function definitions with a blank line, for readability purposes.
| return "Hot"; | ||
| } | ||
|
|
||
| function printWeatherReport(city, tempCelsius) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the function definitions from printWeatherReport() and calculateWindChill() indented like this?
| printWeatherReport("Amsterdam", 22); | ||
|
|
||
| // Wind chill calculation for City 1 | ||
| let windSpeed1 = 15; | ||
| let windChill1 = 13.12 + 0.6215 * tempCelsius1 - 11.37 * Math.pow(windSpeed1, 0.16) + 0.3965 * tempCelsius1 * Math.pow(windSpeed1, 0.16); | ||
| console.log("Wind chill in " + cityName1 + ": " + windChill1.toFixed(2) + "°C"); | ||
| printWeatherReport("berlin", 15); | ||
|
|
||
| // Wind chill calculation for City 2 | ||
| let windSpeed2 = 20; | ||
| let windChill2 = 13.12 + 0.6215 * tempCelsius2 - 11.37 * Math.pow(windSpeed2, 0.16) + 0.3965 * tempCelsius2 * Math.pow(windSpeed2, 0.16); | ||
| console.log("Wind chill in " + cityName2 + ": " + windChill2.toFixed(2) + "°C"); | ||
| printWeatherReport("Copenhagen", 5); | ||
|
|
||
| // Wind chill calculation for City 3 | ||
| let windSpeed3 = 25; | ||
| let windChill3 = 13.12 + 0.6215 * tempCelsius3 - 11.37 * Math.pow(windSpeed3, 0.16) + 0.3965 * tempCelsius3 * Math.pow(windSpeed3, 0.16); | ||
| console.log("Wind chill in " + cityName3 + ": " + windChill3.toFixed(2) + "°C"); No newline at end of file | ||
| printWindChill("Amsterdam", 22, 15); | ||
| printWindChill("Berlin", 15, 20); | ||
| printWindChill("Copenhagen", 5, 25); No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code could be made DRYer still:
| printWeatherReport("Amsterdam", 22); | |
| // Wind chill calculation for City 1 | |
| let windSpeed1 = 15; | |
| let windChill1 = 13.12 + 0.6215 * tempCelsius1 - 11.37 * Math.pow(windSpeed1, 0.16) + 0.3965 * tempCelsius1 * Math.pow(windSpeed1, 0.16); | |
| console.log("Wind chill in " + cityName1 + ": " + windChill1.toFixed(2) + "°C"); | |
| printWeatherReport("berlin", 15); | |
| // Wind chill calculation for City 2 | |
| let windSpeed2 = 20; | |
| let windChill2 = 13.12 + 0.6215 * tempCelsius2 - 11.37 * Math.pow(windSpeed2, 0.16) + 0.3965 * tempCelsius2 * Math.pow(windSpeed2, 0.16); | |
| console.log("Wind chill in " + cityName2 + ": " + windChill2.toFixed(2) + "°C"); | |
| printWeatherReport("Copenhagen", 5); | |
| // Wind chill calculation for City 3 | |
| let windSpeed3 = 25; | |
| let windChill3 = 13.12 + 0.6215 * tempCelsius3 - 11.37 * Math.pow(windSpeed3, 0.16) + 0.3965 * tempCelsius3 * Math.pow(windSpeed3, 0.16); | |
| console.log("Wind chill in " + cityName3 + ": " + windChill3.toFixed(2) + "°C"); | |
| \ No newline at end of file | |
| printWindChill("Amsterdam", 22, 15); | |
| printWindChill("Berlin", 15, 20); | |
| printWindChill("Copenhagen", 5, 25); | |
| function printCityReport(city, tempCelsius, windSpeed) { | |
| printWeatherReport(city, tempCelsius); | |
| printWindChill(city, tempCelsius, windSpeed); | |
| } | |
| printCityReport('Amsterdam', 22, 15); | |
| printCityReport('Berlin', 15, 20); | |
| printCityReport('Copenhagen', 5, 25); |
No description provided.