You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8098b0e
Browse filesBrowse the repository at this point in the historyBrowse files
// It will make the first letter in the string input capitalised.
3
3
4
4
// call the function capitalise with a string input
5
5
// interpret the error message and figure out why an error is occurring
6
+
// "SyntaxError: Identifier 'str' has already been declared"
7
+
8
+
// capitalise("matthaus enjoys foood.")
9
+
10
+
// function capitalise(str) {
11
+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
12
+
// return str;
13
+
// }
14
+
15
+
// The error is thrown by declaring the 'str' variable again in the function with 'let' which causes it throw the SyntaxError, as it is already been declared.
0 commit comments