Skip to content

Commit 99f2a39

Browse files
committed
Revert "Update 0.js"
This reverts commit 3bb9ddf.
1 parent 0d3adae commit 99f2a39

File tree

1 file changed

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

1 file changed

+8
-3
lines changed

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

Lines changed: 8 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+
// =============> the function is not going to work because a variable is declared twice (str)
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,10 @@ function capitalise(str) {
99
return str;
1010
}
1111

12-
// =============> write your explanation here
13-
// =============> write your new code here
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+
}

0 commit comments

Comments
 (0)