-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0.js
More file actions
24 lines (18 loc) · 687 Bytes
/
Copy path0.js
File metadata and controls
24 lines (18 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Predict and explain first...
// =============> I guess we would'nt need to say let in line 8 because str is already decleared as an argument
// within the function capitalise(str).
//
// 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;
//}
//capitalise("hello")
// =============> A syntaxError occured as 'str' is already declared.
// =============> write your new code here
function capitalise(str) {
str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
}
console.log(capitalise("hello"));