Skip to content

Commit 5dfb91e

Browse files
committed
updated 0.js template
1 parent 1bbe9ed commit 5dfb91e

File tree

1 file changed

+5
-2
lines changed
  • Sprint-2/1-key-errors

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 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 str is already declared even though it is a parameter.
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,8 @@ function capitalise(str) {
99
return str;
1010
}
1111

12-
// =============> write your explanation here
12+
// The error is a syntax error at line 8 in which as I have predicted. 'str' was already declared.
1313
// =============> write your new code here
14+
function capitalize(str) {
15+
let capitalized = `${str[0].toUpperCase()}${str.slice(1)}`;
16+
return capitalized;

0 commit comments

Comments
 (0)