Skip to content

London | 26-ITP-SEP | Russom Gebremeskel | Sprint 2 | Coursework - #1531

Open
russom-g wants to merge 72 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2-current
Open

russom-g wants to merge 72 commits into
CodeYourFuture:mainfrom
russom-g:coursework/sprint-2-current

Conversation

@russom-g

@russom-g russom-g commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Task code

CYF-1083

Changelist

Debug, implement and interpret multiple code. Predict, explain and fix code. Implement functions and write test for different inputs

@github-actions

This comment has been minimized.

@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 16, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 16, 2026
@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 16, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 16, 2026
@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 16, 2026
@LonMcGregor LonMcGregor added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 16, 2026
const everything = pair.split("=");
const key = decodeURIComponent(everything.shift().replace(/\+/g, " "));
const value = decodeURIComponent(everything.join("=").replace(/\+/g, " "));
if (queryParams[key]) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What happens to the second a in a=&a=2 with this truthiness check?

To "like" or "dislike" this comment, please follow this link

// E.g. invert({x : 10, y : 20}), target output: {"10": "x", "20": "y"}

function invert(obj) {
if (typeof obj !== "object") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What happens when invert(null) reaches this guard, and which error does the function intend to report for invalid input?

To "like" or "dislike" this comment, please follow this link

// Then it should throw Error("contains requires an object")
// (careful: typeof [] and typeof null are both "object")
test("contains on non-object returns contains requires an object", () => {
expect(() => contains(([1, 2, 3], "a"))).toThrow(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What single value does the comma expression inside contains(...) pass to the function?

To "like" or "dislike" this comment, please follow this link

Comment thread Sprint-2/debug/recipe.js
Comment on lines +21 to +28

//On a new line it prints:
// title: "bruschetta",
// serves: 2,
// ingredients: "olive oil", "tomatoes", "salt", "pepper"

// Explain: on line 15 recipe is missing .ingredients.
// As a result it will print the whole property of recipe object.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These comments describe the pre-fix template, but the current template prints each ingredient on its own line and no longer prints the recipe object. The prediction and explanation should match the code now in the file.

To "like" or "dislike" this comment, please follow this link

Comment thread Sprint-2/debug/address.js

console.log(`My house number is ${address[0]}`);
console.log(`My house number is ${address["houseNumber"]}`);
// Predict: reference error will be returned.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does address[0] produce in the original code, and what does this corrected lookup produce?

To "like" or "dislike" this comment, please follow this link

Comment thread Sprint-2/debug/author.js
console.log(value);
}

// Predict: it will return undefined.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What happens when you run this loop now, and does that match the prediction that it returns undefined?

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 16, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

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

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants