-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0.js
More file actions
20 lines (17 loc) · 702 Bytes
/
Copy path0.js
File metadata and controls
20 lines (17 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Predict and explain first...
// It will give a syntax error on using let str > write your prediction here
// call the function capitalise with a string input - did it with the console.log
// 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;
// }
// console.log(capitalise("newbell"));
// =============> write your explanation here
// str is a parameter which again is getting declared in line 2 of the code
// =============> write your new code here
function capitalise(str) {
str = `${str[0].toUpperCase()}${str.slice(1)}`;
return str;
}
console.log(capitalise("newbell"));