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 1bbe9ed commit 5dfb91eCopy full SHA for 5dfb91e
Sprint-2/1-key-errors/0.js
@@ -1,5 +1,5 @@
1
// Predict and explain first...
2
-// =============> write your prediction here
+// I think str is already declared even though it is a parameter.
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,8 @@ function capitalise(str) {
9
return str;
10
}
11
12
-// =============> write your explanation here
+// The error is a syntax error at line 8 in which as I have predicted. 'str' was already declared.
13
// =============> write your new code here
14
+function capitalize(str) {
15
+ let capitalized = `${str[0].toUpperCase()}${str.slice(1)}`;
16
+ return capitalized;
0 commit comments