Skip to content

London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 2 | Coursework#1123

Open
djebsoft wants to merge 28 commits intoCodeYourFuture:mainfrom
djebsoft:coursework/sprint-2
Open

London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 2 | Coursework#1123
djebsoft wants to merge 28 commits intoCodeYourFuture:mainfrom
djebsoft:coursework/sprint-2

Conversation

@djebsoft
Copy link

@djebsoft djebsoft commented Mar 1, 2026

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

complete sprint 2 mandatory tasks

Questions

Corrected variable declaration issue and updated function to return the capitalized string.
…ge function

Removed duplicate declaration of decimalNumber and updated the function to correctly convert a decimal to a percentage.
Corrected the square function to accept a parameter and return its square.
Refactor multiply function to return result and log output.
Corrected the sum function to return the sum of two numbers.
Corrected the getLastDigit function to accept a parameter and return the last digit of the given number.
Corrected the function getLastDigit to properly accept a parameter.
Added explanations and answers to questions regarding the pad function in time-format.js.
Implemented the toPounds function to convert pence to pounds.
Added a function to convert a string to upper snake case.
@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 1, 2026
Comment on lines +23 to +27
function multiply(a, b) {
return console.log(
`The result of multiplying ` + a + ` and ` + b + ` is ` + a * b
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is a need to output the string in a fixed format from different "places" in the program, it would make sense to implement a function do so.

However, what is the purpose of returning the return value of console.log()? What value do you expect console.log() to return?

Copy link
Author

Choose a reason for hiding this comment

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

we just actually need the function to pass the output to the next line of code after its destroyed
so we need the function to return what its statement evaluate to

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you meant by "destroyed".

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
return (BMI = (weight / (height * height)).toFixed(1)); // return the BMI of someone based off their weight and height
Copy link
Contributor

Choose a reason for hiding this comment

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

  • What is BMI? Why not just return the value of the expression (weight / (height * height)).toFixed(1)?

  • 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
Author

Choose a reason for hiding this comment

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

fixed the statement of the value returned
converted the string to a number

@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 Mar 11, 2026
@djebsoft
Copy link
Author

thank you for reviewing my work
I followed your comments and fixed the bugs

@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 12, 2026
function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
return Number(weight / (height * height)).toFixed(1); // return the BMI of someone based off their weight and height
Copy link
Contributor

Choose a reason for hiding this comment

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

How can you be sure that the function is returning a number and not a string?

Copy link
Author

@djebsoft djebsoft Mar 12, 2026

Choose a reason for hiding this comment

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

by adding the number() to the expression that contains strings
but after your comment I checked it using typeof and it turns out it's string
then I included the whole expression in the number() by adding parentheses, then it worked
but prettier didn't allow me to save the change so I made it in my github remote repository

// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
function upperSnakeCase(wordsSet) {
let wsSnakeCase = wordsSet.replaceAll(" ", "_");
let wsupperSnakeCase = wsSnakeCase.toUpperCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about this version:wsUpperSnakeCase? (No change needed)

Copy link
Author

@djebsoft djebsoft Mar 12, 2026

Choose a reason for hiding this comment

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

I think it could be shortened and embeded in the previous line

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 12, 2026
@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 12, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Mar 12, 2026

Changes are good. Well done.

@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 Mar 12, 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