Skip to content

Cape Town | 26-ITP-Sept | Leigh Ross | Sprint 3 | Coursework: Sprint 3 - #1580

Open
leigh-ross wants to merge 42 commits into
CodeYourFuture:mainfrom
leigh-ross:coursework/sprint-3
Open

leigh-ross wants to merge 42 commits into
CodeYourFuture:mainfrom
leigh-ross:coursework/sprint-3

Conversation

@leigh-ross

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

Changelist

  • Predicted, explained and fixed code errors
  • Wrote and implemented own functions
  • Tested edge cases and still in process of fixing code

@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit 47508e8
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6ab3cebceac38b000874943b
😎 Deploy Preview https://deploy-preview-1580--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

This comment has been minimized.

@leigh-ross leigh-ross added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 23, 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 Sep 23, 2026
@leigh-ross leigh-ross added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 23, 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 Sep 23, 2026
@leigh-ross leigh-ross added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 23, 2026
Comment on lines +28 to +31
function capitalise(str) {
str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
}

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.

This works.

The alternatives of reassigning the function parameters are:

  • Use a separate const variable
  • Return the expression directly

Suggestion: Use AI to explore the trade-off of these approaches.


function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
return (weight / (height * height)).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.

Comment on lines +18 to +21
function UPPER_SNAKE_CASE(str) {
let snake_case = str.replaceAll(" ", "_");
return snake_case.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.

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

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

Then, update the variable names according to those conventions.

Comment on lines +15 to +17

console.log(`£${pounds}.${pence}`);
}

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.

Outputting a value via console.log is not the same as returning that value. Could you update the code to return the pound string?

if (hours > 12) {
return `${hours - 12}:00 pm`;
if (hours >= 12) {
return `${hours - 12}:${time.slice(3)} pm`;

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.

Note: The .slice() method supports negative indices, which count positions from the end of the string.

For example, str.slice(-3) returns the substring containing last three characters from str.

Comment on lines +38 to +47
{ input: "00:00", expected: "12:00 am" }, // midnight
{ input: "01:00", expected: "01:00 am" },
{ input: "02:00", expected: "02:00 am" }, // your failing test
{ input: "09:00", expected: "09:00 am" },
{ input: "11:59", expected: "11:59 am" },
{ input: "12:00", expected: "12:00 pm" }, // noon
{ input: "12:30", expected: "12:30 pm" },
{ input: "13:00", expected: "01:00 pm" },
{ input: "23:00", expected: "11:00 pm" }, // your other test
{ input: "23:59", expected: "11:59 pm" },

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.

These are good test data. However, your function could not yet pass all these tests. Can you update your code accordingly?

@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 Sep 26, 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