London | ITP-may-2026 | Hugh Mills | Sprint 2 | Sprint 2 Coursework#1515
London | ITP-may-2026 | Hugh Mills | Sprint 2 | Sprint 2 Coursework#1515HM-127BTY wants to merge 10 commits into
Conversation
Answered questions.
Added answers to questions.
Added answers to the questions
Added answers to the questions.
added answer to questions asked.
Added answers to the questions asked.
Added code for the bmi calculator,
Completed the code required for the task.
Added the simple code for converting to pounds, using kilograms.
Answered questions required.
| function convertToPercentage(decimalNumber) { | ||
| const decimal = 0.5; | ||
| const percentage = `${decimal * 100}%`; | ||
|
|
||
| return percentage; | ||
|
|
||
| } | ||
| console.log(convertToPercentage) |
There was a problem hiding this comment.
How would you make the function to work for any valid argument?
For example, calling convertToPercentage(0.1) would return "10%".
There was a problem hiding this comment.
Like this?
function convertToPercentage(decimalNumber) {
return percentage = ${decimalNumber * 100}%;
There was a problem hiding this comment.
Correct.
Do lookup Markdown syntax for embedding code.
| function UpperSnake(text) { | ||
| let upperCase = text.toUpperCase(); | ||
| let snakeCase = upperCase.replaceAll(" ","_"); | ||
| return snakeCase; | ||
| } |
There was a problem hiding this comment.
Code is correct.
Can you look up the naming conventions in JavaScript? In particular,
- Variable and function names
Then, update the function names according to those conventions.
There was a problem hiding this comment.
Not to sure what you mean with this one?
There was a problem hiding this comment.
What's best practice to name a function in JavaScript?
| function toPounds(weight) { | ||
| return (weight * 2.204); | ||
| } |
There was a problem hiding this comment.
You are supposed to use the code in Sprint-1/3-mandatory-interpret/3-to-pounds.js to implement this function.
| // b) What is the value assigned to num when pad is called for the first time? | ||
| // =============> write your answer here | ||
| // =============> 61 | ||
|
|
||
| // c) What is the return value of pad is called for the first time? | ||
| // =============> write your answer here | ||
| // =============> "61" |
There was a problem hiding this comment.
When pad() is called the first time, its parameter num is not 61.
|
|
||
| // e) What is the return value of pad when it is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
| // =============> 1 at const remainingSexonds = seconds % 60 gives 1 No newline at end of file |
There was a problem hiding this comment.
What does pad() return when its parameter num is 1?
Learners, PR Template
Self checklist
Changelist
Completed the questions asked and added in code required for each task.