File tree Expand file tree Collapse file tree 3 files changed +2
-54
lines changed
Sprint-2/3-mandatory-implement Expand file tree Collapse file tree 3 files changed +2
-54
lines changed Original file line number Diff line number Diff line change 1414// Then when we call this function with the weight and height
1515// It should return their Body Mass Index to 1 decimal place
1616
17- function calculateBmi ( weight , height ) {
17+ function calculateBMI ( weight , height ) {
1818 // return the BMI of someone based off their weight and height
19- }
20-
21-
22- function calculateBMI ( weight , height ) {
23-
24- let bmi = weight / ( height * height )
25-
26- return bmi . toFixed ( 1 )
27-
28- }
29-
30- console . log ( calculateBMI ( 70 , 1.73 ) )
31-
19+ }
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- // function that turns text into UPPER_SNAKE_CASE
18-
19- function makeUpperSnake ( text ) {
20-
21- let newText = text . replace ( / / g, '_' ) ;
22-
23- newText = newText . toUpperCase ( ) ;
24-
25- return newText ;
26-
27- }
28- console . log ( makeUpperSnake ( "hello there" ) ) ;
29- console . log ( makeUpperSnake ( "lord of the rings" ) ) ;
30-
31-
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-
9-
10-
11- function toPounds ( penceString ) {
12-
13- let numberStr = penceString . substring ( 0 , penceString . length - 1 ) ;
14-
15- numberStr = numberStr . padStart ( 3 , "0" ) ;
16-
17- let pounds = numberStr . substring ( 0 , numberStr . length - 2 ) ;
18-
19- let pence = numberStr . substring ( numberStr . length - 2 ) . padEnd ( 2 , "0" ) ;
20-
21- return "£" + pounds + "." + pence ;
22- }
23-
24- console . log ( toPounds ( "399p" ) ) ;
25- console . log ( toPounds ( "50p" ) ) ;
26- console . log ( toPounds ( "5p" ) ) ;
27- console . log ( toPounds ( "1200p" ) ) ;
28-
29-
30-
31-
You can’t perform that action at this time.
0 commit comments