Skip to content

Commit 2c6aae7

Browse files
author
Payman IB
committed
1-key-errors,0.js, completed
1 parent 8f3d6cf commit 2c6aae7

File tree

1 file changed

+12
-5
lines changed
  • Sprint-2/1-key-errors

1 file changed

+12
-5
lines changed

Sprint-2/1-key-errors/0.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// it gives us an error.
34

45
// call the function capitalise with a string input
56
// interpret the error message and figure out why an error is occurring
67

7-
function capitalise(str) {
8-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9-
return str;
10-
}
8+
// function capitalise(str) {
9+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10+
// return str;
11+
// }
1112

12-
// =============> write your explanation here
13+
// =============> write your explanation here :
14+
// as the variable in side the function has the same name as the function variable.
1315
// =============> write your new code here
16+
function capitalise(str) {
17+
let str1 = `${str[0].toUpperCase()}${str.slice(1)}`;
18+
return str1;
19+
}
20+
console.log(capitalise("abcd"));

0 commit comments

Comments
 (0)