Skip to content

Conversation

@Abrsh100
Copy link

@Abrsh100 Abrsh100 commented Nov 7, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I fix the errors incounterd in the function as well as in the test and creat new function to pass the tests

Questions

no questions

@Abrsh100 Abrsh100 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 7, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

  • Code is very solid.

  • Indentation is a bit off in some of the files. Can you improve the indentation on these files?

age: 40,
alive: true,
};
console.log(author)
Copy link
Contributor

Choose a reason for hiding this comment

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

This works (for displaying the properties) to certain extent.

However, I think the objective of this exercise is to practice how to iterate through all the property values of an object. Can you figure out how to use a loop to accomplish that?

Copy link
Author

Choose a reason for hiding this comment

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

got it

return false;
}

return properityValue in object;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion
Consider the following two approaches for determining if an object contains a property:

  let obj = {}, propertyName = "toString";
  console.log( propertyName in obj );                // true
  console.log( Object.hasOwn(obj, propertyName) );   // false

Which of these approaches suits your needs better?
For more info, you can look up JS "in" operator vs Object.hasOwn.

Comment on lines 9 to 16
const index = pair.indexOf("=");
if (index === -1) {
queryParams[pair] = undefined;
} else {
const key = pair.slice(0, index);
const value = pair.slice(index + 1);
queryParams[key] = value;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that in real querystring, both key and value are percent-encoded or URL encoded in the URL. For example, the string "5%" will be encoded as "5%25". So to get the actual value of "5%25" (whether it is a key or value in the querystring), you should call a function to decode it.
May I suggest looking up any of these terms, and "How to decode URL encoded string in JS"?

Comment on lines 1 to 12
function tally(input) {
if (!Array.isArray(input)) {
throw new Error("Input must be an array");
}

const counts = {};
for (let item of input) {
counts[item] = (counts[item] || 0) + 1;
}

return counts;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the following function call returns the value you expect?

tally(["toString", "toString"]);

Suggestion: Look up an approach to create an empty object with no inherited properties.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 15, 2025
@Abrsh100 Abrsh100 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 19, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Nov 20, 2025

When you make changes based on review comments, please respond directly to each comment. Even a short acknowledgement is helpful. This makes the review process clearer, shows your reasoning, and ensures that nothing gets overlooked. Code review is a conversation, not just an edit pass.

Comment on lines 7 to 20

for (const pair of keyValuePairs) {
const index = pair.indexOf("=");
if (index === -1) {
queryParams[decodeURIComponent(pair)] = undefined
} else {
const key = pair.slice(0, index);
const value = pair.slice (index + 1);
queryParams[key] = value;
}
return queryParams;

return queryParams;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • No all keys and values are properly URL-decoded.

  • The indentation is a bit off.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 20, 2025
@Abrsh100 Abrsh100 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 26, 2025
Comment on lines 3 to 21
const queryParams = {};
if (!queryString ) return queryParams;

const keyValuePairs = queryString.split("&");

for (const pair of keyValuePairs) {
const index = pair.indexOf("=");
if (index === -1) {
queryParams[decodeURIComponent(pair)] = undefined
} else {
const key = decodeURIComponent (pair.slice(0, index));
const value = decodeURIComponent (pair.slice (index + 1));
queryParams[key] = value;
}

return queryParams;

}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Code is still not properly indented.

Why not use the VSCode built-in "Format document" feature (after installing the "prettier" VSCode extension) to auto format the code?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 27, 2025
@Abrsh100 Abrsh100 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 1, 2025
@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants