File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed 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- function convertToPercentage ( decimalNumber ) {
9- const decimalNumber = 0.5 ;
10- const percentage = `${ decimalNumber * 100 } %` ;
8+ // function convertToPercentage(decimalNumber) {
9+ // let decimalNumber = 0.5;
10+ // const percentage = `${decimalNumber * 100}%`;
1111
12- return percentage ;
13- }
12+ // return percentage;
13+ // }
1414
15- console . log ( decimalNumber ) ;
15+ // console.log(decimalNumber);
1616
1717// =============> write your explanation here
18+ //const decimalNumber cant be declared because it is already being set by the function,
19+ // so it gives error, that line can removed.
20+ // And the console log needs to call the function convertToPercentage(0.5) not decimalNumber
1821
1922// Finally, correct the code to fix the problem
2023// =============> write your new code here
24+
25+ function convertToPercentage ( decimalNumber ) {
26+ const percentage = `${ decimalNumber * 100 } %` ;
27+
28+ return percentage ;
29+ }
30+
31+ console . log ( convertToPercentage ( 0.5 ) ) ;
You can’t perform that action at this time.
0 commit comments