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
// =============> I presume the str is repeatedly declared, first as a parameter and again as a variable.
4
3
// call the function capitalise with a string input
5
4
// interpret the error message and figure out why an error is occurring
6
5
6
+
7
7
functioncapitalise(str){
8
8
letstr=`${str[0].toUpperCase()}${str.slice(1)}`;
9
9
returnstr;
10
10
}
11
11
12
-
// =============> write your explanation here
13
-
// =============> write your new code here
12
+
13
+
// =============> str is already declared in the parameter and shouldn't be declared inside the function. The error says it's been declared already for this reason. Therefore we need to rename the str inside the function.
14
+
/* ==========> function capitalise(str) {
15
+
let result = `${str[0].toUpperCase()}${str.slice(1)};
0 commit comments