We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4cb9354 commit 2fafe6eCopy full SHA for 2fafe6e
Sprint-2/1-key-errors/0.js
@@ -7,11 +7,11 @@
7
// interpret the error message and figure out why an error is occurring
8
// after trying to run the code it produced a "SyntaxError: Identifier 'str' has already been declared"
9
10
-function capitalise(str) {
+/* function capitalise(str) {
11
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
12
return str;
13
}
14
-console.log(capitalise("hello"));
+console.log(capitalise("hello")); */
15
// =============> write your explanation here
16
// this is because the variable str is declared twice, once in the function parameters and again inside the function body with "let str"
17
// 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