-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Millena mesfin/Sprint-2-exercices /structuring and testing data #221
base: main
Are you sure you want to change the base?
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.
Hi i would appreciate it if someone could review my PR?
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.
The code in Sprint-2/debug/2.js
is not quite correct.
Everything else is good.
// Line#5; we need to make getLastDigit accept a parameter. | ||
|
||
function getLastDigit(number) { | ||
return num.toString().slice(-1); |
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.
Have you executed your script to verify your function can correctly return the last digit?
I don't think console.log( getLastDigit(806) )
will output 6 with your current implementation.
// .replace(/ /g, "_") uses a regular expression to replace all spaces in the string with underscores (_), where the /g flag ensures that all spaces are replaced (not just the first one). | ||
// Using .replace(/ /g, "_") with the g flag tells JavaScript to replace all spaces in the string, not just the first one. | ||
// /g: Replaces all occurrences of the pattern, but is case-sensitive. | ||
// /gi: Replaces all occurrences of the pattern and is case-insensitive. |
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.
You are using / /gi
(instead of / /g
) in your code. How does the i
flag affect the result?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.