File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// Why will an error occur when this program runs?
4- // =============> write your prediction here
4+ // decimalNumber is already used as a parameter so it can not be used as a variable inside the function,
5+ // the code is logging the parameter instead of the function
56
67// Try playing computer with the example to work out what is going on
78
9+ // function convertToPercentage(decimalNumber) {
10+ // const decimalNumber = 0.5;
11+ // const percentage = `${decimalNumber * 100}%`;
12+
13+ // return percentage;
14+ // }
15+
16+ // console.log(decimalNumber);
17+
18+ // I'm not sure about what to write here
19+
20+ // Finally, correct the code to fix the problem
821function convertToPercentage ( decimalNumber ) {
9- const decimalNumber = 0.5 ;
1022 const percentage = `${ decimalNumber * 100 } %` ;
1123
1224 return percentage ;
1325}
1426
15- console . log ( decimalNumber ) ;
16-
17- // =============> write your explanation here
18-
19- // Finally, correct the code to fix the problem
20- // =============> write your new code here
27+ console . log ( convertToPercentage ( 0.9 ) )
You can’t perform that action at this time.
0 commit comments