Skip to content

Commit 245e73e

Browse files
error fixed
1 parent 9cf4441 commit 245e73e

File tree

1 file changed

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

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
// interpret the error message and figure out why an error is occurring
1010

1111
function capitalise(str) {
12-
str = `${str[0].toUpperCase()}${str.slice(1)}`;
12+
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
1313
return str;
1414
}
15-
let result = capitalise("Arun");
16-
console.log(result);
15+
1716
// =============> write your explanation here
1817
// The parameter str is already a local variable inside the function.
1918
// Previously, redeclaring it using let caused an error because variables cannot be declared twice in the same scope.

0 commit comments

Comments
 (0)