Skip to content

Commit baad84d

Browse files
committed
fixed code and added explanation
1 parent eaac290 commit baad84d

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

  • Sprint-3/1-key-errors

‎Sprint-3/1-key-errors/1.js‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
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}%`;
11+
12+
//return percentage;
13+
//}
14+
15+
//console.log(decimalNumber);
16+
//Because decimalNumber is declared twice it wont work but when i call the function convertToPercentage and pass in 0.5 it will get assigned to the parameter decimalNumber so i need to update the code to reflect this.
17+
818
function convertToPercentage(decimalNumber) {
9-
const decimalNumber = 0.5;
1019
const percentage = `${decimalNumber * 100}%`;
11-
1220
return percentage;
1321
}
22+
console.log(convertToPercentage(0.5));
1423

15-
console.log(decimalNumber);
16-
17-
// =============> write your explanation here
18-
19-
// Finally, correct the code to fix the problem
20-
// =============> write your new code here
24+
//console output: 50%

0 commit comments

Comments
 (0)