Skip to content

Commit ea7eebf

Browse files
committed
checking
1 parent b383e53 commit ea7eebf

File tree

1 file changed

+9
-7
lines changed
  • Sprint-2/1-key-errors

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
// call the function capitalise with a string input
88
// interpret the error message and figure out why an error is occurring
99

10-
function capitalise(str) {
11-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
12-
return str;
13-
}
10+
// function capitalise(str) {
11+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
12+
// return str;
13+
// }
1414

15-
// =============> write your explanation here => The error occurs because you cannot declare
15+
// =============> write your explanation here => The error occurs because we cannot declare
1616
// a new variable with the same name as a function parameter (str) using let inside the function.
17-
// This causes a "Identifier 'str' has already been declared" error.
17+
// This causes a "Identifier 'str' has already been declared" error according to mdn.
1818

1919

2020
// =============> write your new code here
2121
function capitalise(str) {
2222
return `${str[0].toUpperCase()}${str.slice(1)}`;
23-
}
23+
}
24+
25+
console.log(capitalise("bethan"));

0 commit comments

Comments
 (0)