Skip to content

Shamisa A - #7

Open
chamisaw wants to merge 1 commit into
HackYourAssignment:mainfrom
chamisaw:main
Open

chamisaw wants to merge 1 commit into
HackYourAssignment:mainfrom
chamisaw:main

Conversation

@chamisaw

Copy link
Copy Markdown

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

@RHSebregts RHSebregts left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread task-1/book.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Comment thread task-2/parse-date.js
return { day: second, month: first, year: year };
}

return { day: first, month: second, year: year };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what do we do when we get a different (nonsensical) value for format?

Comment thread task-3/date.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice and concise, I like it!

Comment thread task-4/cleanup.js
Comment on lines +11 to 25
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";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early returns, and no else, love it!

Comment thread task-4/cleanup.js
Comment on lines +28 to +35
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("---");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, but to make it easier on yourself to write these strings, I'd advise you to read about Template Literals.

Comment thread task-4/cleanup.js

// 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@RHSebregts RHSebregts added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed Review in progress labels Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants