Skip to content

Commit f070a00

Browse files
committed
Answering the task
1 parent 8beb07d commit f070a00

File tree

1 file changed

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

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =============> I predict that we will not need to write let in line 8 as str is already declared
3+
// as an argument within the function captialise.
34

45
// call the function capitalise with a string input
56
// interpret the error message and figure out why an error is occurring
67

8+
// function capitalise (str) {
9+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10+
// return str;
11+
// }
12+
13+
// capitalise ('hello');
14+
//==============> A syntaxError occurred as 'str' is being cleared.
15+
16+
717
function capitalise(str) {
8-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
18+
str = `${str[0].toUpperCase()}${str.slice(1)}`;
919
return str;
1020
}
21+
console.log (capitalise ('hello'));
22+
1123

12-
// =============> write your explanation here
13-
// =============> write your new code here

0 commit comments

Comments
 (0)