Skip to content

LONDON | MAY2025 | STRUCTURING AND TESTING DATA | SPRING 2 JESUS DEL MORAL#537

Closed
delmorallopez wants to merge 5 commits intoCodeYourFuture:mainfrom
delmorallopez:coursework/sprint-2
Closed

LONDON | MAY2025 | STRUCTURING AND TESTING DATA | SPRING 2 JESUS DEL MORAL#537
delmorallopez wants to merge 5 commits intoCodeYourFuture:mainfrom
delmorallopez:coursework/sprint-2

Conversation

@delmorallopez
Copy link
Copy Markdown

I have committed my files one by one, on purpose, and for a reason
I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
I have tested my changes
My changes follow the style guide
My changes meet the requirements of this task

SPRINT 2 with 5 commits

  • key-errors
  • Mandatory-debug
  • Mandatory-implement
  • Mandatory-Interpret

@delmorallopez delmorallopez added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 13, 2025
@delmorallopez delmorallopez changed the title LONDON | MAY2025 | STRUCTURING AND TESTING DATA | SPRING 2 LONDON | MAY2025 | STRUCTURING AND TESTING DATA | SPRING 2 JESUS DEL MORAL Jun 13, 2025
Copy link
Copy Markdown

@Amundeep-Dhaliwal Amundeep-Dhaliwal left a comment

Choose a reason for hiding this comment

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

Hello Jesus, thanks for your patience and for completing this work.

Have made some comments on the code, all the solutions look good to me.

// =============> write your new code here

function capitalise(str) {
let capitalised = `${str[0].toUpperCase()}${str.slice(1)}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks good to me.


function multiply(a, b) {
console.log(a * b);
return(a * b);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this is correct

function sum(a, b) {
return;
a + b;
return(a+b)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this is correct.

In JS lines can be terminated with a semicolon.

// const num = 103;

function getLastDigit() {
function getLastDigit(num) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this is a good parameter name.

} No newline at end of file
const bmi = 0

height = height * height;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes this solution is correct, perhaps in the future we can avoid reusing variables?

It makes the code more confusing, it is good practice to use new variables:
let heightSquared = height * height;

return str
.trim() // Remove leading/trailing whitespace
.toUpperCase() // Convert to uppercase
.replace(/\s+/g, '_'); // Replace spaces with underscores
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a nice use of regular expressions here and I like your helpful comments.

Well done.

.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0");

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

Choose a reason for hiding this comment

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

This function behaves as expected.

Are we supposed to use a return statement instead of a console.log command?

We have a console.log command on line 33 as well.


// 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 last time we called Pad is 1, but the return is 01
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These answers are logically correct.

Be mindful of what the question is asking here,

We can rephrase the last part of the question as:
`explain why the remainingSeconds variable returns the value of 01 when inputted into the pad function?'

The return value of pad is not being asked for here.


// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
// =============> write your answer here
// The value is returned is 01
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Explain questions ask for verbal reasoning for the reason that the return value is what it is.

Your answer could be something along the lines of:
The return value when pad is called with the input of 1 is 01 because we zero pad the front of the the number so it is 2 digits.

@Amundeep-Dhaliwal Amundeep-Dhaliwal 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. labels Jul 2, 2025
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.

3 participants