File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66// Try playing computer with the example to work out what is going on
77
8-
98function convertToPercentage ( decimalNumber ) {
10- return `${ decimalNumber * 100 } %` ;
11- }
12-
13- console . log ( convertToPercentage ( 0.1 ) ) ;
9+ const decimalNumber = 0.5 ;
10+ const percentage = `${ decimalNumber * 100 } %` ;
1411
12+ return percentage ;
13+ }
1514
1615console . log ( decimalNumber ) ;
1716// =============> it says decimalNumber has aleady been declared for the above reason.
1817
1918
2019// Finally, correct the code to fix the problem
2120/* ===========> function convertToPercentage(decimalNumber) {
22- let decimalNum = 0.5;
23- const percentage = `${decimalNum * 100}%`;
24-
25-
26- return percentage;
21+ const result = `${decimalNumber * 100}%`;
22+ return result;
2723}
28- const result = convertToPercentage();
29- console.log(result);
24+ console.log(convertToPercentage(0.1));
3025*/
3126
3227
You can’t perform that action at this time.
0 commit comments