Skip to content

Commit 576dc5a

Browse files
debug2604debug2604
authored andcommitted
Predicted what I expect, explained Syntax Error, added the new code
1 parent d28242a commit 576dc5a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • Sprint-3/1-key-errors

‎Sprint-3/1-key-errors/0.js‎

Lines changed: 7 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 expect the function capitalise will turn first letter of string given by user into capital letter.
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,9 @@ function capitalise(str) {
99
return str;
1010
}
1111

12-
// =============> write your explanation here
13-
// =============> write your new code here
12+
// =============> The result was a Syntax error because str has been declared as parameter of function captialise before let reassign str.
13+
// =============>
14+
function capitalise(str) {
15+
str = `${str[0].toUpperCase()}${str.slice(1)}`;
16+
return str;
17+
}

0 commit comments

Comments
 (0)