Skip to content

Commit 8ef3eaf

Browse files
committed
completed the 3-mandtory-implement of sprint-2
1 parent bb7033c commit 8ef3eaf

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Sprint-2/3-mandatory-implement/1-bmi.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616

1717
function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
19-
}
19+
let bmi = weight / (height * height);
20+
return bmi.toFixed(1);
21+
}
22+
console.log(calculateBMI(80, 1.80)); // should return 24.7

Sprint-2/3-mandatory-implement/2-cases.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@
1414
// You will need to come up with an appropriate name for the function
1515
// Use the MDN string documentation to help you find a solution
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
17+
18+
function toUpperSnakeCase(str){
19+
return str.toUpperCase().replaceAll(" " , "_");
20+
}
21+
console.log(toUpperSnakeCase("hello there")); // should return "HELLO_THERE"
22+
console.log(toUpperSnakeCase("lord of the rings")); // should return "LORD_OF_THE_RINGS"

Sprint-2/3-mandatory-implement/3-to-pounds.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
// You will need to declare a function called toPounds with an appropriately named parameter.
55

66
// You should call this function a number of times to check it works for different inputs
7+
8+
function toPounds(kilograms) {
9+
return +(kilograms * 2.20462).toFixed(1);
10+
}
11+
console.log(toPounds(1)); // should return 2.2
12+
console.log(toPounds(5)); // should return 11
13+
console.log(toPounds(10)); // should return 22

0 commit comments

Comments
 (0)