-
-
Notifications
You must be signed in to change notification settings - Fork 337
Expand file tree
/
Copy path0.js
More file actions
12 lines (10 loc) · 551 Bytes
/
0.js
File metadata and controls
12 lines (10 loc) · 551 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
// Predict and explain first...
// =============> When we call capitalise("fay"), it will throw an error instead of returning "Fay"
// call the function capitalise with a string input
// interpret the error message and figure out why an error is occurring
// =============> "str" has already been declared, in JavaScript we can not redeclare a parameter using let inside the same scope.
// =============> write your new code here
function capitalise(str) {
return str = `${str[0].toUpperCase()}${str.slice(1)}`;
}
console.log(capitalise("fay"));