- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 240
London | 25-ITP-SEP | Sophia Mohamed | Sprint 2 | coursework/sprint-2 #803
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?
Changes from 7 commits
7312985
              113d089
              c9700bf
              f693105
              15d0324
              3178e15
              a4cfc97
              17480c0
              d1dfef3
              cf13333
              33218f8
              03351dd
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| // Predict and explain first... | ||
|  | ||
| // =============> write your prediction here | ||
| // =============> console.log will print the result because log()will write the message to the console. | ||
| // | ||
|  | ||
| function multiply(a, b) { | ||
| console.log(a * b); | ||
| } | ||
|  | ||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|  | ||
| // =============> write your explanation here | ||
|  | ||
| // =============> When testing the code in Node.js, the output was 320 without the message because it was undefined "The result of multiplying 10 and 32 is undefined". | ||
| //we need to use return to store the result then print it out. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| // =============> // Corrected Code: | ||
| function multiply(a, b) { | ||
| return a * b; // Use 'return' instead of 'console.log' | ||
| } | ||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|  | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4,3 +4,16 @@ | |
| // You will need to declare a function called toPounds with an appropriately named parameter. | ||
|  | ||
| // You should call this function a number of times to check it works for different inputs | ||
|  | ||
| function toPounds(kg) { | ||
| const pounds = kg * 2.20462; | ||
|  | ||
| return pounds; | ||
|          | ||
| } | ||
| console.log(toPounds(1)); | ||
| console.log(toPounds(5)); | ||
| console.log(toPounds(10)); | ||
| // if I want to round the result to 2 decimal places I can use toFixed(2) | ||
| console.log(toPounds(1).toFixed(2)); | ||
| console.log(toPounds(5).toFixed(2)); | ||
| console.log(toPounds(10).toFixed(2)); | ||
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 objective of this exercise is to complete the implementation of the function
calculateBMI()so that we can reuse the code in the function to calculate BMI for different weight and height.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 have updated the function