Skip to content

Robel H. - #16

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

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

Conversation

@robzi18

@robzi18 robzi18 commented Nov 18, 2026

Copy link
Copy Markdown

No description provided.

@Naraujo13 Naraujo13 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.

Hey!

Great job on the Week 3 assignment! 🎉

The code is very clean and readable, showing a good grasp of modules and functions. The refactoring on task 4 especially is spot on and applies DRY principles very well!

I've added a few inline comments across files, but they're mostly small tips and more advanced edge cases.

Feel free to reply here or reach out in Slack if you have any questions about the comments. Keep up the great work!

Comment thread task-1/book.js
// Your code here
const prompt = require("prompt-sync")();
const bookName = "the fundamentals of javascript";
let isApplicable;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A best practice is to keep variables from a given function scoped to it. Here this means moving this declaration to inside the isBookApplicable function.

That allows us to keep the isApplicable variable isolated to the function and to each invocation.

Comment thread task-1/book.js
const bookName = "the fundamentals of javascript";
let isApplicable;
function isBookApplicable(book) {
book = book.toLowerCase().trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bonus: usually a best practice when manipulating parameters inside a function is to avoid reassigning them, instead declaring a new variable and assigning to it. This helps improve readability and avoid side effects of potentially modifying the parameter.

e.g. const cleanBook = book.toLowerCase().trim().

Comment thread task-2/parse-date.js

let dateFormat = dateString.split(" ")[0].toLowerCase().trim();
let date = dateString.split(" ")[1];
const dateParts = date.split(/[\/\-\.]/).map(Number); //coz user might separate differently

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice logic for the split!

Comment thread task-4/cleanup.js
0.3965 * temp * Math.pow(windSpeed, 0.16);
return windChill.toFixed(2);
}
function showWeather(city, temp, windSpeed) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great to see the logging modularised into a reusable function!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants