Skip to content

Commit ff58b19

Browse files
committed
gave explanation on the error message and wrote a code to fix the error
1 parent dc1ecca commit ff58b19

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33

44
// call the function capitalise with a string input
55
// interpret the error message and figure out why an error is occurring
6-
//
6+
//It says syntax error Identifier 'str' has already been declared.
7+
// function parameter and let which is inside the funtion can never
8+
// be the same because both variables are in the same scope
79
function capitalise(str) {
810
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
911
return str;
1012
}
1113
console.log(capitalise("error")
1214
//
13-
// =============> write your new code here
15+
// function capitalise(firstLetter){
16+
// let str =`${str[0].toUpperCase()${str.slice(1)}`;
17+
// return str;
18+
// }
19+
//
20+

0 commit comments

Comments
 (0)