Skip to content

Commit bfbcbe1

Browse files
explained error and removed let
1 parent 32407f9 commit bfbcbe1

File tree

1 file changed

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

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// I think this function capitalise is meant to make the first letter of a string into uppercase then return the string
33

44
// call the function capitalise with a string input
55
// interpret the error message and figure out why an error is occurring
@@ -9,5 +9,11 @@ function capitalise(str) {
99
return str;
1010
}
1111

12-
// =============> write your explanation here
13-
// =============> write your new code here
12+
// I got the error "SyntaxError: Identifier 'str' has already been declared"
13+
// to fix this, I just removed the word let in line 8. This gave a value to str without trying to declare it again
14+
// I ran the new code and there were no errors
15+
16+
// function capitalise(str) {
17+
// str = `${str[0].toUpperCase()}${str.slice(1)}`;
18+
// return str;
19+
// }

0 commit comments

Comments
 (0)