Skip to content

Manchester | ITP-MAY-2026 | Yee Man Tsang | Sprint 2 | Coursework/Sprint-2#1416

Open
lintsang wants to merge 5 commits into
CodeYourFuture:mainfrom
lintsang:coursework/sprint-2
Open

Manchester | ITP-MAY-2026 | Yee Man Tsang | Sprint 2 | Coursework/Sprint-2#1416
lintsang wants to merge 5 commits into
CodeYourFuture:mainfrom
lintsang:coursework/sprint-2

Conversation

@lintsang

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

Changelist

Finished all exercises in all folders in sprint 2

@lintsang lintsang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 27, 2026
Comment thread Sprint-2/3-mandatory-implement/1-bmi.js Outdated
function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
return (weight / height**2).toFixed(1);

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for reminder. I learnt that the types of value should be carefully considered when I am writing the code.

// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase

function UPPER_SNAKE_CASE(string){
upperString = string.toUpperCase();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should upperString be declared using const or let?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I would use const here as I am not going to reassign the value in this case.

// Use the MDN string documentation to help you find a solution
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase

function UPPER_SNAKE_CASE(string){

@cjyuan cjyuan Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you look up the naming conventions in JavaScript? In particulars,

  • Variable and function names
  • Class and Types names
  • Named constants

Then, update the function name according to those conventions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Many thanks. I clearly understand the naming conventions in Javascript now.

Comment on lines +6 to +8
while (numString.length < 2) {
numString = "0" + numString;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

num is either a 1-digit or 2-digit number. A conditional statement is probably enough.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for letting me know about this issue which I haven't noticed it before.


function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
const minute = pad(Number(time.slice(3,5)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • What's the difference between minute and time.slice(3, 5)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

After reading the code again, I found the type of 'minute' is expected to be in string, while time.slice(3, 5) is already a string and I decided to assign to it directly. Thanks!

Comment thread Sprint-2/5-stretch-extend/format-time.js Outdated
Comment thread Sprint-2/5-stretch-extend/format-time.js
@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 Jul 2, 2026
@lintsang lintsang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 5, 2026
@cjyuan

cjyuan commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Have you made any change based on the comments? If so, you would need to push them to GitHub so that I can review them.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 5, 2026
@lintsang lintsang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 6, 2026
@cjyuan

cjyuan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Changes look good.

I am not sure why GitHub shows me the older version of your files yesterday.

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 6, 2026
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.

2 participants