Skip to content

Commit 3bb9ddf

Browse files
authored
Update 0.js
Removed duplicate variable declaration and fixed typo in return statement.
1 parent 177c368 commit 3bb9ddf

File tree

1 file changed

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

1 file changed

+3
-8
lines changed

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Predict and explain first...
2-
// =============> the function is not going to work because a variable is declared twice (str)
2+
// =============> write your prediction here
33

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

12-
// =============> the error message 'Identifier 'str' has already been declared', diplays because the toUpperCase function does not change the value of the varible declared
13-
// but it creates a new one.
14-
// =============> my new code:
15-
function capitalise(str) {
16-
let result = `${str[0].toUpperCase()}${str.slice(1)}`;
17-
return resault;
18-
}
12+
// =============> write your explanation here
13+
// =============> write your new code here

0 commit comments

Comments
 (0)