Skip to content

Commit 78f21df

Browse files
committed
revert changes to sprint 2 folder
1 parent 8b52886 commit 78f21df

File tree

1 file changed

+4
-14
lines changed
  • Sprint-2/1-key-errors

1 file changed

+4
-14
lines changed

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
//we should have an error showing that str already exists so we cannot declare it again inside the function.
43

54
// call the function capitalise with a string input
65
// interpret the error message and figure out why an error is occurring
76

8-
//function capitalise(str) {
9-
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10-
// return str;
11-
//}
12-
13-
//console.log(capitalise("cat"));
14-
15-
// =============> write your explanation here
16-
//str has been passed down as a parameter so we cannot declare it again. we would need to declare a different variable name.
17-
// =============> write your new code here
187
function capitalise(str) {
19-
let capitalisedStr = `${str[0].toUpperCase()}${str.slice(1)}`;
20-
return capitalisedStr;
8+
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9+
return str;
2110
}
2211

23-
console.log(capitalise("cat"));
12+
// =============> write your explanation here
13+
// =============> write your new code here

0 commit comments

Comments
 (0)