-
-
Notifications
You must be signed in to change notification settings - Fork 197
WM | 25-ITP-May | Nahom Mesfin | Sprint 2 coursework #676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
WM | 25-ITP-May | Nahom Mesfin | Sprint 2 coursework #676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work on this sprint - there's an issue in one function I want you to have another look at
Sprint-2/1-key-errors/1.js
Outdated
|
||
// Finally, correct the code to fix the problem | ||
// =============> write your new code here | ||
function convertToPercentage(decimalNumber) { | ||
decimalNumber = 0.5; // Remove 'const' to avoid redeclaration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do this, what will happen if Irun the code with a different parameter? Like covertToPercentage(0.7)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i see, convertToPercentage(0.7)
will log 50% because I have already assigned the value to be 0.5. I will fix the issue just by removing the value declartion decimalNumber = 0.5;
and It will give the correct result which is 70%
Great work, you're done with this sprint now |
Learners, PR Template
Self checklist
Changelist
In Errors, I predicted and verified error messages by running files and explained their causes. In Debug, I identified why programs misbehave, tested predictions, and fixed the code. In Implement, I wrote functions based on given requirements and tested them with various inputs. In Interpret, I analyzed larger programs using mdn web doc and other sources to understand unfamiliar code and fix the code.