You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-3/1-key-errors/1.js
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,31 @@
2
2
3
3
// Why will an error occur when this program runs?
4
4
// =============> write your prediction here
5
+
// decimalNumber is part of the function so it cant be set with const decimalNumber, the name needs to be different.
6
+
// console.log(decimalNumber) causes an issue as well, decimalNumber is part of the function, it should request convertToPercentage for it to work.
5
7
6
8
// Try playing computer with the example to work out what is going on
7
9
8
-
functionconvertToPercentage(decimalNumber){
9
-
constdecimalNumber=0.5;
10
-
constpercentage=`${decimalNumber*100}%`;
10
+
// function convertToPercentage(decimalNumber) {
11
+
// const decimalNumber = 0.5;
12
+
// const percentage = `${decimalNumber * 100}%`;
11
13
12
-
returnpercentage;
13
-
}
14
+
// return percentage;
15
+
// }
14
16
15
-
console.log(decimalNumber);
17
+
// console.log(decimalNumber);
16
18
17
19
// =============> write your explanation here
20
+
// console.log(decimalNumber) will not work as decimalNumber is inside the function,
21
+
// and "const devimalNumber = 0.5" has already been called from teh function. You need to change the name or apply the value in the call on consol.log()
0 commit comments