Skip to content

Commit 00fdc77

Browse files
solving exercise 0.js
1 parent d28242a commit 00fdc77

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • Sprint-3/1-key-errors

‎Sprint-3/1-key-errors/0.js‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// Tha parameter 'str' is declared another time insie the function , this will cause an error to be thrown.
34

45
// call the function capitalise with a string input
56
// interpret the error message and figure out why an error is occurring
@@ -9,5 +10,10 @@ function capitalise(str) {
910
return str;
1011
}
1112

12-
// =============> write your explanation here
13-
// =============> write your new code here
13+
// =============> write your explanation here SyntaxError: Identifier 'str' has already been declared => line 10 varibale str should not be declared again.
14+
// =============> write your new code
15+
// function capitalise(str) {
16+
// str = `${str[0].toUpperCase()}${str.slice(1)}`;
17+
// return str;
18+
// }
19+
// console.log(capitalise("hello world"));

0 commit comments

Comments
 (0)