-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0.js
More file actions
15 lines (10 loc) · 534 Bytes
/
Copy path0.js
File metadata and controls
15 lines (10 loc) · 534 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Predict and explain first...
// =============> When we call capitalise("hello"), it will throw an error instead of returning "Hello".
// 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.
// =============>
function capitalise(str) {
return `${str[0].toUpperCase()}${str.slice(1)}`;
}
console.log(capitalise("hello"));