Skip to content

Commit a729eff

Browse files
committed
Fix capitalise function variable redeclaration
1 parent a9cb566 commit a729eff

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Predict and explain first...
22
// =============> We will have syntax error because string is the parameter of the function and the next line,it is declared wit let
3-
//so it is declared two times in one part
3+
//so it is declared two times in one part
44
// call the function capitalise with a string input
55

6-
76
function capitalise(str) {
87
str = `${str[0].toUpperCase()}${str.slice(1)}`;
98
return str;
@@ -17,7 +16,7 @@ function capitalise(str) {
1716
}
1817

1918
// =============> write your explanation here SyntaxError: Identifier 'str' has already been declared
20-
// =============> write your new code here.
21-
function capitalise(str) {
19+
// =============> write your new code here.
20+
function capitalise(str) {
2221
return `${str[0].toUpperCase()}${str.slice(1)}`;
2322
}

0 commit comments

Comments
 (0)