Skip to content

Commit a03c919

Browse files
committed
prediction and explanation
1 parent 9fede25 commit a03c919

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • Sprint-2/1-key-errors

Sprint-2/1-key-errors/1.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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) {
1516
console.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));

0 commit comments

Comments
 (0)