Glasgow | 26-ITP-Jan| Martin McLean | Sprint 2 | coursework#963
Glasgow | 26-ITP-Jan| Martin McLean | Sprint 2 | coursework#963mjm-git185 wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sprint-2/1-key-errors/2.js
Outdated
|
|
||
| // // =============> write the error message here | ||
| // /home/martinmclean158/Module-Structuring-and-Testing-Data/Sprint-2/1-key-errors/0.js:8 | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; |
There was a problem hiding this comment.
I think the error message is wrong. Try running it again
Sprint-2/2-mandatory-debug/0.js
Outdated
| // // =============> write your new code here | ||
| function multiply(a, b) { | ||
| const result = a * b; | ||
| console.log(result); |
There was a problem hiding this comment.
Since there is a console.log of the result outside the function, is there a need for the console.log in the function?
Sprint-2/2-mandatory-debug/2.js
Outdated
| // =============> yes thay all give 3 | ||
| // Explain why the output is the way it is | ||
| // =============> write your explanation here | ||
| // because the variable is a consrent |
There was a problem hiding this comment.
Based on your explanation.
It means if I add const num = 103; to your solution before getLastDigit(), will it return 3 for all the console logs?
There was a problem hiding this comment.
// because the variable is a const before the code block when num is called it can't be changed
There was a problem hiding this comment.
I think you should study global and local variables and how scope works. It will help you understand this code better
There was a problem hiding this comment.
my understanding was that the const out side of the code block was in the global scope and because of that would over ride the local scope of the code block, so when it is run the console.log would pick up the global and ignore the local "num"
There was a problem hiding this comment.
If a new variable of the same name is declared within the code block, the code will use that new variable and ignore the global variable. Reason why when you passed num into that function, it used what was passed and not the global num.
| function calculateBMI(weight, height) { | ||
| // return the BMI of someone based off their weight and height | ||
| } No newline at end of file | ||
| let bmi = weight/(height*height) |
There was a problem hiding this comment.
Can you explain why you used let instead of const?
| // You will need to come up with an appropriate name for the function | ||
| // Use the MDN string documentation to help you find a solution | ||
| // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase | ||
| function SNAKE_CASE (mesasge){ |
There was a problem hiding this comment.
Does the name of the function follow the appropriate naming convention? Does it explain what the function does?
|
|
||
| // b) What is the value assigned to num when pad is called for the first time? | ||
| // =============> write your answer here | ||
| // "null" |
There was a problem hiding this comment.
Since totalHours is the value used to call pad for the first time. Try doing a console.log to be sure it is null
|
i have made the changes needed |
I can't find the changes you made. |
|
You are supposed to make your changes to this pull request. @mjm-git185 |
|
i edited them on vs code and pushed them to git-hub |
From your VS Code, you are supposed to checkout to this branch |
|
i have pushed it up and the version i can see is the most recent one #7bc1235 |
Seen |
|
that one has the revisions |
Changelist
my coursework