Skip to content

Commit 6e0c311

Browse files
committed
declared a new variable to hold capitalised string
1 parent e353f01 commit 6e0c311

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • Sprint-2/1-key-errors

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
// }
1212

1313
// =============> write your explanation here
14-
// i will remove the let keyword, which is only used for declaration and assignment, when redeclaring we do not use the let keyword
14+
// I will remove the let keyword, which is only used for declaration and assignment, when redeclaring we do not use the let keyword
1515
// =============> write your new code here
16-
function capitalise(str){
17-
str = `${str[0].toUpperCase()}${str.slice(0)}`;
18-
return str
16+
function capitalise(str) {
17+
const capitalisedStr = `${str[0].toUpperCase()}${str.slice(1)}`;
18+
return capitalisedStr
1919
}
20+
2021
console.log(capitalise("butter"))

0 commit comments

Comments
 (0)