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 5433734
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-3/1-key-errors/0.js
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,18 @@
7
7
// interpret the error message and figure out why an error is occurring
8
8
// Error message interpreted ====> The error message simply means the name 'str' was declared twice in the same scope
9
9
10
-
functioncapitalise(str){
11
-
letstr=`${str[0].toUpperCase()}${str.slice(1)}`;
12
-
returnstr;
13
-
}
14
-
capitalise("moses");
10
+
// function capitalise(str) {
11
+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
12
+
// return str;
13
+
// }
14
+
// capitalise("moses");
15
15
// =============> write your explanation here
16
16
// The error here is because the parameter 'str' and the variable 'let str' share the same name in he same scope, thus the SyntaxError.
17
17
// To fix this error, I could either give the variable a different name or reassign the parameter 'str' without 'let', since no new declaration is made
0 commit comments