Skip to content

Commit ce5e2ad

Browse files
committed
Revert "Update 1.js"
This reverts commit 177c368.
1 parent 99f2a39 commit ce5e2ad

File tree

1 file changed

+10
-3
lines changed
  • Sprint-2/1-key-errors

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Predict and explain first...
22

33
// Why will an error occur when this program runs?
4-
// =============> write your prediction here
4+
// =============> because first: the variable decimalNumber is declared twice
5+
// second: the parameter decimalNumber is assigned to a value inside the function
56

67
// Try playing computer with the example to work out what is going on
78

@@ -14,7 +15,13 @@ function convertToPercentage(decimalNumber) {
1415

1516
console.log(decimalNumber);
1617

17-
// =============> write your explanation here
18+
// =============> Identifier 'decimalNumber' has already been declared is the error msg thrown by the code
1819

1920
// Finally, correct the code to fix the problem
20-
// =============> write your new code here
21+
// =============>
22+
function convertToPercentage(decimalNumber) {
23+
// const decimalNumber = 0.5; this line must be deleted
24+
const percentage = `${decimalNumber * 100}%`;
25+
26+
return percentage;
27+
}

0 commit comments

Comments
 (0)