Skip to content

Commit 514bece

Browse files
fix formatting to exercise 1.js
1 parent 92e3132 commit 514bece

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,20 @@
33
// Why will an error occur when this program runs?
44
// =============> write your prediction here D: Answer => variable decimalNumber is declared twice : one time in the parameter and another time inside the function
55

6-
76
// function convertToPercentage(decimalNumber) {
87
// //const decimalNumber = 0.5;
98
// const percentage = `${decimalNumber * 100}%`;
10-
119
// return percentage;
1210
// }
1311

1412
// console.log(decimalNumber);
15-
1613
// =============> write your explanation here
1714
// solution :Also in line 15 console.log is trying print a variable which is not defined instead of calling the function convertToPercentage .
1815
// Finally, correct the code to fix the problem
1916
// =============> write your new code here
2017

21-
function convertToPercentage(decimalNumber) {
22-
23-
const percentage = `${decimalNumber * 100}%`;
24-
25-
return percentage;
26-
}
27-
28-
console.log(convertToPercentage(0.5));
18+
function convertToPercentage(decimalNumber) {
19+
const percentage = `${decimalNumber * 100}%`;
20+
return percentage;
21+
}
22+
console.log(convertToPercentage(0.5));

0 commit comments

Comments
 (0)