-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0.js
More file actions
19 lines (15 loc) · 770 Bytes
/
Copy path0.js
File metadata and controls
19 lines (15 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Predict and explain first...
// =============> write your prediction here
// I think that the first letter of the string will be upper case and then the .slice method will extract a part of a string and return the extracted part, being --> apitalise.
// call the function capitalise with a string input
// interpret the error message and figure out why an error is occurring
// function capitalise is already a variable and let str is decalring that variable again but str already exists.
//function capitalise(str) {
//let str = `${str[0].toUpperCase()}${str.slice(1)}`;
//return str;
//}
// =============> write your explanation here
// =============> write your new code here
function capitalise(str) {
return `${str[0].toUpperCase()}${str.slice(1)}`;
}