File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33// Why will an error occur when this program runs?
44// =============> write your prediction here
5+ //the function is there to convert the given number to percentage
56
67// Try playing computer with the example to work out what is going on
78
@@ -15,6 +16,19 @@ function convertToPercentage(decimalNumber) {
1516console . log ( decimalNumber ) ;
1617
1718// =============> write your explanation here
19+ //the function is there to convert the given number to percentage
20+ //the error will come up again as the decimalNumber has already been declared - we don't need to assign this as a variable again
21+ //the console log missing the assigned number with the brackets
22+ //also we would need to call the function not the parameter
23+
1824
1925// Finally, correct the code to fix the problem
2026// =============> write your new code here
27+ //function convertToPercentage(decimalNumber) {
28+ // decimalNumber = 0.5;
29+ //const percentage = `${decimalNumber * 100}%`;
30+
31+ //return percentage;
32+ //}
33+
34+ //console.log(convertToPercentage(decimalNumber));
You can’t perform that action at this time.
0 commit comments