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-2/1-key-errors/1.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,12 @@
12
12
// Try playing computer with the example to work out what is going on
13
13
14
14
functionconvertToPercentage(decimalNumber){
15
-
decimalNumber=0.5;
15
+
constdecimalNumber=0.5;
16
16
constpercentage=`${decimalNumber*100}%`;
17
17
18
18
returnpercentage;
19
19
}
20
-
console.log(convertToPercentage());
20
+
console.log(decimalNumber);
21
21
22
22
// =============> write your explanation here
23
23
//The error occurred because a local variable was redeclared inside the function using a variable keyword. Since the parameter already acts as a local variable, redeclaring it caused an error.
0 commit comments