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 db2d6dd commit 2076556Copy full SHA for 2076556
Sprint-2/1-key-errors/0.js
@@ -1,5 +1,5 @@
1
// Predict and explain first...
2
-// =============> write your prediction here
+// =============> there are two declarations of the variable str.
3
4
// call the function capitalise with a string input
5
// interpret the error message and figure out why an error is occurring
@@ -9,5 +9,10 @@ function capitalise(str) {
9
return str;
10
}
11
12
-// =============> write your explanation here
13
-// =============> write your new code here
+// =============> str is declared twice in the function capitalise and using let.
+
14
+// =============> we delete the 'let'
15
+function capitalise(str) {
16
+ str = `${str[0].toUpperCase()}${str.slice(1)}`;
17
+ return str;
18
+}
0 commit comments