Skip to content

Commit 9cf4441

Browse files
error fixed
1 parent 7555838 commit 9cf4441

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// Try playing computer with the example to work out what is going on
1313

1414
function convertToPercentage(decimalNumber) {
15-
decimalNumber = 0.5;
15+
const decimalNumber = 0.5;
1616
const percentage = `${decimalNumber * 100}%`;
1717

1818
return percentage;
1919
}
20-
console.log(convertToPercentage());
20+
console.log(decimalNumber);
2121

2222
// =============> write your explanation here
2323
//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

Comments
 (0)