Skip to content

Commit 2fafe6e

Browse files
fix: comment out erroneous capitalize function to prevent redeclaration error so that new code will work correctly and not throw the old error
1 parent 4cb9354 commit 2fafe6e

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/0.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
// interpret the error message and figure out why an error is occurring
88
// after trying to run the code it produced a "SyntaxError: Identifier 'str' has already been declared"
99

10-
function capitalise(str) {
10+
/* function capitalise(str) {
1111
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
1212
return str;
1313
}
14-
console.log(capitalise("hello"));
14+
console.log(capitalise("hello")); */
1515
// =============> write your explanation here
1616
// this is because the variable str is declared twice, once in the function parameters and again inside the function body with "let str"
1717
// str is declared as a parameter, so we don't need to declare it again with let you can just use it directly.

0 commit comments

Comments
 (0)