Skip to content

Conversation

@Abrsh100
Copy link

@Abrsh100 Abrsh100 commented Oct 25, 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 have done all the tasks required for this sprint

Questions

No questions

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@Abrsh100 Abrsh100 changed the title Glasgow | 25-ITP-Sep | Abraham-Habte | Sprint 2 | Coursework Sprint 2 Glasgow | 25-ITP-Sep | Abraham-Habte | Sprint 2 | Coursework/sprint-2 Oct 25, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@Abrsh100 Abrsh100 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 25, 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.

A clean branch should not contain any unrelated change.

Change = difference between your branch and the target branch (CYF's main).

When you delete files originally in the repo (e.g., files in Sprint-1 folder), they will be identified as changed files.

To keep this branch clean, can you restore the files in the Sprint-1 folder (by copying the same files from CYF's main)?

  • Download the repo as a ZIP file and unzip the file to a temporary folder.
  • On your local repository, switch to coursework/sprint-2 branch.
  • Replace the Sprint-1 folder in your repo by the Sprint-1 folder in the temporary folder
  • Commit the change and push the change to GitHub.

@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 Oct 26, 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 Oct 27, 2025
return str;
}
// The error occurs in line 13 and it says "SyntaxError: Identifier 'str' has already been declared"
// The error is informing us that the string str has already been declared in line 12 so we can not declare it again.
Copy link
Contributor

Choose a reason for hiding this comment

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

the string str

Calling str a "string" isn’t quite right. Try using a term that describes it as a name rather than a value.
Accurate terminology is essential for clear communication and precise reasoning about how code works.

function calculateBMI(weight, height) {
function calculateBMI(weight, height) {
const bmi= weight/ (height*height)
return bmi.toFixed(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What type of value do you expect your function to return? A number or a string?
Does your function return the type of value you expect?

Different types of values may appear identical in the console output, but they are represented and treated differently in the program. For example,

  console.log(123);              // Output 123
  console.log("123");            // Output 123
  
  // Treated differently in the program
  let sum1 = 123 + 100;         // Evaluate to 223 -- a number
  let sum 2 = "123" + 100;      // Evaluate to "123100" -- a string.

}

console.log(toUpperCase("hello there"));
console.log(toUpperCase("lord of the ring"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this output LORD_OF_THE_RINGS?

// You will need to declare a function called toPounds with an appropriately named parameter.

// You should call this function a number of times to check it works for different inputs
function toPounds(pennies) {
Copy link
Contributor

@cjyuan cjyuan Oct 27, 2025

Choose a reason for hiding this comment

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

The parameter value is expected to be a string in the form "399p" (a sting with a trailing 'p').


// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
// =============> write your answer here
/* The value assigned to num when the pad is called for the last time is "1". */
Copy link
Contributor

Choose a reason for hiding this comment

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

A notation like "1" (a value enclosed by a pair of double quotes) is conventionally used to suggest the value is a string.

So use of double quotes on "00" in the previous question is good. But for a number-type value, use of double quotes could be misleading.

Comment on lines 5 to 18
function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
if (hours===0) {
return`12:00 am`
}
if (hours===12) {
return `12:00 pm`
}
if (hours > 12) {
return `${hours - 12}:00 pm`;
}
return `${time} am`;
if (hours > 0 && hours < 12)
return `${String(hours).padStart(2, "0")}:00 am`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does your function return the value you expected from each of the following function calls?

  • formatAs12HourClock("00:31")
  • formatAs12HourClock("12:31")
  • formatAs12HourClock("01:31")
  • formatAs12HourClock("13:31")

@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 Oct 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 Oct 29, 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.

Some of the scripts you changed has some issues. Can you test all your scripts to ensure the code in the scripts works as expected?

}

console.log(toUpperCase("hello there"));
console.log(toUpperCase("lord of the ring"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Does your function work for this function call? Does it output LORD_OF_THE_RING?

console.log(toUpperCase("lord of the ring"));

return `${String(hours).padStart(2, "0")}:00 am`;
const minutes = time.slice(3, 5);
const ampm = hours >= 12 ? "pm" : "am";
const Hour = String(hours % 12 === 0 ? 12 : hours % 12).padStart(2, "0")
Copy link
Contributor

Choose a reason for hiding this comment

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

The convention is to begin a variable name with a lowercase letter.
Name that begins with an uppercase letter is conventionally reserved for data type. For example, String.

}
if (hours > 0 && hours < 12)
return `${String(hours).padStart(2, "0")}:00 am`;
const minutes = time.slice(3, 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

time.slice(-2) is probably more expressive (no need to calculate the starting and ending positions).

Comment on lines +23 to +25
function capitalise(firstLetters) {
firstLetters = `${firstLetters[0].toUpperCase()}${firstLetters.slice(1)}`;
return firstLetters;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why changed str to firstLetters?

@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 Oct 29, 2025
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