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
// Why will an error occur when this program runs?
4
-
// =============> write your prediction here
4
+
// =============> write your prediction here D: Answer => variable decimalNumber is declared twice : one time in the parameter and another time inside the function
5
5
6
-
// Try playing computer with the example to work out what is going on
7
6
8
7
functionconvertToPercentage(decimalNumber){
9
-
constdecimalNumber=0.5;
8
+
//const decimalNumber = 0.5;
10
9
constpercentage=`${decimalNumber*100}%`;
11
10
12
11
returnpercentage;
@@ -15,6 +14,15 @@ function convertToPercentage(decimalNumber) {
15
14
console.log(decimalNumber);
16
15
17
16
// =============> write your explanation here
18
-
17
+
// solution :Also in line 15 console.log is trying print a variable which is not defined instead of calling the function convertToPercentage .
0 commit comments