Skip to content

Commit 608b21e

Browse files
author
Arthur
committed
define parameter and the function
1 parent 93486c9 commit 608b21e

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
// Below are the steps for how BMI is calculated
21

3-
// The BMI calculation divides an adult's weight in kilograms (kg) by their height in metres (m) squared.
42

5-
// For example, if you weigh 70kg (around 11 stone) and are 1.73m (around 5 feet 8 inches) tall, you work out your BMI by:
63

7-
// squaring your height: 1.73 x 1.73 = 2.99
8-
// dividing 70 by 2.99 = 23.41
9-
// Your result will be displayed to 1 decimal place, for example 23.4.
4+
function calculateBMI(weight, height) {
5+
6+
let newheight = height / 100;
7+
let num = weight / (newheight ** 2);
8+
let idea = num.toFixed(1);
9+
10+
return idea;
11+
}
12+
13+
14+
console.log(calculateBMI(58, 178));
15+
16+
17+
1018

11-
// You will need to implement a function that calculates the BMI of someone based off their weight and height
1219

13-
// Given someone's weight in kg and height in metres
14-
// Then when we call this function with the weight and height
15-
// It should return their Body Mass Index to 1 decimal place
1620

17-
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
// UPPER_SNAKE_CASE means taking a string and writing it in all caps with underscores instead of spaces.
55

66
// Implement a function that:
7+
function convertToUpperCase(text) {
8+
const result = text.toUpperCase();
9+
return result;
10+
}
11+
12+
console.log(convertToUpperCase("hello"));
13+
14+
15+
16+
717

818
// Given a string input like "hello there"
919
// When we call this function with the input string

0 commit comments

Comments
 (0)