File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
Sprint-2/3-mandatory-implement Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1616
1717function calculateBMI ( weight , height ) {
1818 // return the BMI of someone based off their weight and height
19- }
19+ }
20+ ( calculateBMI ( weight / hight * hight ) ) ;
21+ let bmi = 85 / ( 1.54 * 1.54 ) ;
22+ console . log ( bmi )
23+ //here the result was 35.833307439446366 I need to round it to 1 decimal place
24+ console . log ( bmi . toFixed ( 1 ) ) ;
25+ //now the output is 35.8
26+
Original file line number Diff line number Diff line change 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+ // There is 2 things we need to do: change the space to_ and change the letters from lowercase to uppercase
19+
20+ function toUpperSnakeCase ( str ) {
21+ return str
22+ . replaceAll ( ' ' , '_' ) // replace spaces with underscores
23+ . toUpperCase ( ) ; // make everything uppercase
24+ }
25+
26+ console . log ( toUpperSnakeCase ( "hello there" ) ) ;
27+ console . log ( toUpperSnakeCase ( "lord of the rings" ) ) ;
Original file line number Diff line number Diff line change 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 ( kg ) {
9+ const pounds = kg * 2.20462 ;
10+
11+ return pounds ;
12+ }
13+ console . log ( toPounds ( 1 ) ) ;
14+ console . log ( toPounds ( 5 ) ) ;
15+ console . log ( toPounds ( 10 ) ) ;
16+ // if I want to round the result to 2 decimal places I can use toFixed(2)
17+ console . log ( toPounds ( 1 ) . toFixed ( 2 ) ) ;
18+ console . log ( toPounds ( 5 ) . toFixed ( 2 ) ) ;
19+ console . log ( toPounds ( 10 ) . toFixed ( 2 ) ) ;
You can’t perform that action at this time.
0 commit comments