Skip to content

Commit a33085b

Browse files
committed
Restore original file contents
1 parent f4d3f59 commit a33085b

File tree

1 file changed

+6
-21
lines changed
  • Sprint-2/1-key-errors

1 file changed

+6
-21
lines changed

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

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
// Predict and explain first...
2-
// =============> write your prediction here:
3-
// I think their will be an error because of the str tag
4-
5-
6-
7-
2+
// =============> write your prediction here
83

94
// call the function capitalise with a string input
10-
console.log(capitalise("hello")); // should print "Hello"
11-
12-
135
// interpret the error message and figure out why an error is occurring
146

7+
function capitalise(str) {
8+
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9+
return str;
10+
}
1511

16-
//function capitalise(str) {
17-
//let str = `${str[0].toUpperCase()}${str.slice(1)}`;
18-
//return str;
19-
//}
20-
21-
// =============> write your explanation here:
22-
// str is being used as both the function parameter and a variable inside the function, causing a conflict.
23-
24-
12+
// =============> write your explanation here
2513
// =============> write your new code here
26-
27-
function capitalise(inputStr) {
28-
return `${inputStr[0].toUpperCase()}${inputStr.slice(1)}`;}

0 commit comments

Comments
 (0)