File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Instead, we should define the expression a * b
1414and return the expression .
1515
1616/ function multiply ( a , b ) {
17- return ( a * b ) ;
17+ return a * b ;
1818 }
1919
2020console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
Original file line number Diff line number Diff line change 11Unexpected identifier "problem"
22variable hasn 't been defined so the variable cannot do function.
33
4- function sum ( a , b ) {
5- return ;
6- a + b ;
7- }
8-
9- console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
10-
114
125because return should be followed by a + b ;
136the final result doesn 't return the value.
147
158
169function sum ( a , b ) {
17- return ;
18- a + b ;
10+ return a + b ;
1911}
2012
2113console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
Original file line number Diff line number Diff line change 11
2-
3-
42function calculateBMI ( weight , height ) {
53
64 let newheight = height / 100 ;
75 let num = weight / ( newheight ** 2 ) ;
8- let idea = num . toFixed ( 1 ) ;
6+ let result = num . toFixed ( 1 ) ;
97
10- return idea ;
8+ return result ;
119}
1210
1311
@@ -18,3 +16,4 @@ console.log(calculateBMI(58, 178));
1816
1917
2018
19+
Original file line number Diff line number Diff line change 55
66// Implement a function that:
77function convertToUpperCase ( text ) {
8- const result = text . toUpperCase ( ) ;
9- return result ;
8+
9+ const result = text . split ( ' ' ) . join ( "_" ) ;
10+
11+ return result . toUpperCase ( ) ;
1012}
1113
12- console . log ( convertToUpperCase ( "hello" ) ) ;
14+
15+
16+ console . log ( convertToUpperCase ( "hello there" ) ) ;
1317
1418
1519
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ function formatAs12HourClock(time) {
1313 return `${ paddedHour } :${ minutes } pm` ;
1414 }
1515
16- else if ( hours === 0o0 ) {
16+ else if ( hours === 0 ) {
1717 const newHour = hours + 12 ;
1818 return `${ newHour } :${ minutes } am` ; }
1919
2020 else if ( hours === 12 ) {
21- return `12:00 pm` ;
21+ return `12:${ minutes } pm` ;
2222
2323 }
2424
You can’t perform that action at this time.
0 commit comments