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 56bcd60
Browse filesBrowse the repository at this point in the historyBrowse files
// fixing errors in the code to get the right result
3
4
4
5
// call the function capitalise with a string input
6
+
//console.log(capitalise("hello"));
7
+
5
8
// interpret the error message and figure out why an error is occurring
9
+
// str has already been declared in function as a parameter, so we need to change str in let declaration and change names of the identifier in let declaration.
6
10
7
-
functioncapitalise(str){
8
-
letstr=`${str[0].toUpperCase()}${str.slice(1)}`;
9
-
returnstr;
10
-
}
11
+
// function capitalise(str) {
12
+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
13
+
// return str;
14
+
// }
11
15
12
16
// =============> write your explanation here
17
+
18
+
//The function is to capitalise a word or sentence to a uppercase.
19
+
// when i tested the code it didn't work and i received a Syntexerror message which said that the identifier `str`has already been declared
20
+
//it was declared in the function and repeatedly twice and tried to create a variable with let when this is already a parameter.
0 commit comments