West Midlands | May-26-ITP | Alina Sofragiu | Sprint 2 | Coursework#1385
West Midlands | May-26-ITP | Alina Sofragiu | Sprint 2 | Coursework#1385sofragiualina wants to merge 1 commit into
Conversation
jayshreehajgude2012
left a comment
There was a problem hiding this comment.
handled errors correctly
implemented code correctly
Formatted output using inbuilt function correctly
|
|
||
| // =============> write your explanation here | ||
| // =============> write your new code here | ||
| // =============> The error message says that str has already been declared this happens because str is already the function parameter,and the code tries to create another variable called str using let JavaScript does not allow a parameter and a let variable to have the same name in the same scope |
| console.log(decimalNumber); | ||
|
|
||
| // =============> write your explanation here | ||
| // =============> The error happens because decimalNumber is already a parameter of the function, so we cannot declare it again using const |
There was a problem hiding this comment.
correct explanation is given
Note: Try to understand the difference between let, var and const
There was a problem hiding this comment.
Thank you for the feedback, I understand that the main issue is the difference between let, var, and const.I will review the differences between var, let, and const to strengthen my understanding of variable declarations and scope in JavaScript.
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
| // =============> the function only uses console.log() so it prints the result but does not return it when a function has no return, JavaScript returns undefined,which is why undefined appears in the final sentence |
There was a problem hiding this comment.
correct explanation
Note: explore undefined
There was a problem hiding this comment.
I will explore undefined further to improve my understanding of how JavaScript handles functions that do not explicitly return a value
| @@ -1,5 +1,5 @@ | |||
| // Predict and explain first... | |||
| // =============> write your prediction here | |||
| // =============> The sum of 10 and 32 is undefined because the function returns nothing | |||
There was a problem hiding this comment.
Thank you for the feedback
| // You will need to declare a function called toPounds with an appropriately named parameter. | ||
|
|
||
| // You should call this function a number of times to check it works for different inputs | ||
| function toPounds(penceString) { |
There was a problem hiding this comment.
logic is correct
made use of inbuild functions for formatting output
There was a problem hiding this comment.
I still have a lot to learn about this but I understand that using built-in string methods helps format the output more cleanly and reliably
Learners, PR Template
Self checklist
Changelist
Completed solutions to sprint 2 coursework