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
// =============> write your prediction here : There will be an error.
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
6
7
7
functioncapitalise(str){
8
8
letstr=`${str[0].toUpperCase()}${str.slice(1)}`;
9
9
returnstr;
10
-
}
11
10
12
-
// =============> write your explanation here
13
-
// =============> write your new code here
11
+
12
+
// =============> write your explanation here : Because str has been used(declared) twice. As an input(parameter) to the function(capitalise) and with let. We should used a different variable.
13
+
14
+
// =============> write your new code here :
15
+
/*
16
+
function capitalise(str) {
17
+
let cap = `${str[0].toUpperCase()}${str.slice(1)}`;
0 commit comments