-
-
Notifications
You must be signed in to change notification settings - Fork 335
Expand file tree
/
Copy path0.js
More file actions
19 lines (15 loc) · 677 Bytes
/
0.js
File metadata and controls
19 lines (15 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Predict and explain first...
// I am not able to predict any error, everything seems fine to me.
// call the function capitalise with a string input
// interpret the error message and figure out why an error is occurring
function capitalise(str) {
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
}
// =============> Yeah, str name for the variable is already being used as the parameter of the function,
// that's why we can't declare it agian as being done in line 8.
// =============> the correct code would be as follows:
/*function capitalise(str) {
let capitaliseStr = `${str[0].toUpperCase()}${str.slice(1)}`;
return capitaliseStr;
}*/