File tree Expand file tree Collapse file tree
Sprint-2/3-mandatory-implement Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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- }
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments