-
-
Notifications
You must be signed in to change notification settings - Fork 154
London| Emmanuel Gessessew | Module-Structuring-and-Testing-Data/ sprint 2 | WEEK 2 #130
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?
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.
Thanks for your hard work here, @Emmanuelgessessew . Really great stuff.
Your PR is still really messed up. You need to open from MAIN for each new branch. Come to class to get help with understanding this.
In real life this work would be rejected. But in this case, spend a bit of time instead on thinking about my questions and comments. Take a look in the solutions branch and compare your work and think about revising one or two things. This is a a really strong learning technique.
Good luck!
// console.log(a * b); | ||
// } | ||
|
||
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); |
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.
It would be very beneficial for your learning to formally write out your prediction before changing the code.
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.
Thanks for the suggestion! I'll make sure to write out my predictions before making any changes in the future to better understand the code and improve my learning process.
// Explain why getLastDigit is not working properly - correct the problem | ||
|
||
// correction | ||
// when the num is defined in the above code it uses the const it should use the let, since getLastDigit is not a constant number. |
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.
Hmm, I don't think let or const is salient here.
Do you think you need to assign 103 to num? Why would you need to do this?
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.
how about this, function getLastDigit(num) {
return num % 10;
}
|
||
//correction | ||
// the problem is the capitalise function is that it is re declaring the str parameter inside the function using let. | ||
// we canot do that cause the str is already a defined function. |
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.
It's not a defined function. It is defined, but what is it, exactly? Try to be precise here in your explanation.
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.
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}, wat if i do this
function capitalise(str) { | ||
let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
str = `${str[0].toUpperCase()}${str.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.
Do you need to assign this to str? Have a think
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.
i don't need to assign the capitalized string back to str. Instead, function capitalise(str) {
return ${str[0].toUpperCase()}${str.slice(1)}
;
}
|
||
//correction | ||
// the problem in the above code is that it redeclaring the decimalNumber with const. | ||
// and the The variable decimalNumber is only available inside the function calling it outside will result in error |
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.
What kind of error?
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 error will be when u encounter if you try to access decimalNumber outside the function is a ReferenceError
// } | ||
|
||
// correction | ||
// the problem in the above code is it didnt defined the num as a parameter of square. |
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.
Can 3 ever be a parameter in JavaScript? What kind of error did this code produce?
@@ -22,3 +22,5 @@ console.assert( | |||
currentOutput2 === targetOutput2, |
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.
What happened here? Do you need help with this one?
|
||
function toUpperSnakeCase(input) { | ||
|
||
const withUnderscores = input.replace(/ /g, "_"); |
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.
Nice!
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
i made changes and corrected some errors and also interpreted some codes.
Questions
Ask any questions you have for your reviewer.