Skip to content

Commit 9aef627

Browse files
author
kohanman
committed
Sprint 2 | Coursework 1.1
1 parent a976af7 commit 9aef627

File tree

1 file changed

+17
-6
lines changed
  • Sprint-2/1-key-errors

1 file changed

+17
-6
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,27 @@
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}%`;
8+
// function convertToPercentage(decimalNumber) {
9+
// let decimalNumber = 0.5;
10+
// const percentage = `${decimalNumber * 100}%`;
1111

12-
return percentage;
13-
}
12+
// return percentage;
13+
// }
1414

15-
console.log(decimalNumber);
15+
// console.log(decimalNumber);
1616

1717
// =============> write your explanation here
18+
//const decimalNumber cant be declared because it is already being set by the function,
19+
// so it gives error, that line can removed.
20+
// And the console log needs to call the function convertToPercentage(0.5) not decimalNumber
1821

1922
// Finally, correct the code to fix the problem
2023
// =============> write your new code here
24+
25+
function convertToPercentage(decimalNumber) {
26+
const percentage = `${decimalNumber * 100}%`;
27+
28+
return percentage;
29+
}
30+
31+
console.log(convertToPercentage(0.5));

0 commit comments

Comments
 (0)