Skip to content

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

Open
lintsang wants to merge 4 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 4 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
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.

// 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?

// 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.

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.


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)?

Comment on lines +51 to +52
const currentOutput5 = formatAs12HourClock("00:00");
const targetOutput5 = "00:00 am";

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.

Shouldn't "00:00" be converted to "12:00 am"?

Comment on lines 12 to 21
function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
const minute = pad(Number(time.slice(3,5)));
if (hours > 12) {
return `${hours - 12}:00 pm`;
return `${hours - 12}:${minute} pm`;
} else if (hours == 12 & minute == '00'){
return `${time} pm`;
}
return `${time} am`;
}

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 do you expect from the following function calls?

 formatAs12HourClock("08:35");
 formatAs12HourClock("20:35");
 formatAs12HourClock("12:34");
 formatAs12HourClock("00:34");

Do they return the values you expected? Are the returned values consistently formatted?

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