London | 25-ITP-Sep | Payman Issa Baiglu | Sprint 2 | Coursework/sprint 2#838
London | 25-ITP-Sep | Payman Issa Baiglu | Sprint 2 | Coursework/sprint 2#838PaymanIB wants to merge 23 commits intoCodeYourFuture:mainfrom
Conversation
… correct convertToPercentage function implementation
jennethydyrova
left a comment
There was a problem hiding this comment.
Hi @PaymanIB! Very good work on these exercises! I left several comments you need to address. You also have some extra file in the commit you pushed, can you please remove it?
Sprint-2/1-key-errors/0.js
Outdated
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
|
|
||
| // it gives us an error. |
There was a problem hiding this comment.
You should try to be more specific, what type of error?
Sprint-2/1-key-errors/0.js
Outdated
| let str1 = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str1; |
There was a problem hiding this comment.
Why do you use let here? Also, can you think of a way to simplify these two lines?
| // Why will an error occur when this program runs? yes | ||
| // =============> write your prediction here | ||
| // decimalNumber is declared before and can not be declared again. | ||
| // console.log(decimalNumber) should be console.log(convertToPercentage) |
There was a problem hiding this comment.
This is correct but why is that a case? Why we can't do console.log(decimalNumber)?
There was a problem hiding this comment.
I think the only comment left unaddressed is this one @PaymanIB
There was a problem hiding this comment.
looks good overall @PaymanIB, I'd just suggest cleaning up code by removing unused comments.
Sprint-2/1-key-errors/1.js
Outdated
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function convertToPercentage(decimalNumber) { | ||
| //const decimalNumber = 0.5; |
There was a problem hiding this comment.
Let's keep the code clean and remove all scratch work and commented out code (within functions you wrote).
Sprint-2/1-key-errors/1.js
Outdated
| const percentage = `${decimalNumber * 100}%`; | ||
|
|
||
| return percentage; |
There was a problem hiding this comment.
Can you think of a way to simplify this?
Sprint-2/2-mandatory-debug/2.js
Outdated
|
|
||
| // Predict the output of the following code: | ||
| // =============> Write your prediction here | ||
| // the result will be 3 times |
| const penceStringWithoutTrailingP = penceString.substring(0 , penceString.length - 1); | ||
| const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); | ||
| const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2); | ||
| const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); | ||
|
|
||
| return `£${pounds}.${pence}`; |
There was a problem hiding this comment.
Do you have prettier installed? If no, I would recommend installing it and formatting your code. This is not a correct indentation, makes your code look messier
| const totalMinutes = (seconds - remainingSeconds) / 60; //1 | ||
| const remainingMinutes = totalMinutes % 60; //1 |
There was a problem hiding this comment.
Do you need these comments here?
|
Hi @PaymanIB! Do you want to do another round of review? If yes, please change label to needs review and request review. |
|
Hi @jennethydyrova, Sorry for the late reply and many thanks for your help and support. Unfortunately, I had a very rough week last week and couldn't focus on finishing this task. I would appreciate if you can review the changes I made based on your first review. Thanks and regards. |
|
Hi @PaymanIB! The changes look good but can you please remove |
|
Hi @jennethydyrova, I totally forgot that part. Thanks for reminding me. that file is deleted. Would you please check again. |
|
@wahibkamran Thank you for reviewing my PR. If it is OK. can you please change the label to complete as well. |
|
@PaymanIB set to complete |
|
Great! Thank you! |
in this PR: Sprint 2 Coursework completed. errors fixed and questions answered