Skip to content

Commit 3f55757

Browse files
committed
Change variable name to be more descriptive
1 parent 9c17ff7 commit 3f55757

File tree

1 file changed

+6
-8
lines changed
  • Sprint-2/1-key-errors

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
// call the function capitalise with a string input
55
// interpret the error message and figure out why an error is occurring
66

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

1211
// =============> write your explanation here : Because str has been used(declared) twice. As an input(parameter) to the function(capitalise) and with let. We should used a different variable.
1312

1413
// =============> write your new code here :
15-
/*
14+
1615
function capitalise(str) {
17-
let cap = `${str[0].toUpperCase()}${str.slice(1)}`;
18-
return cap;
16+
let capitalised = `${str[0].toUpperCase()}${str.slice(1)}`;
17+
return capitalised;
1918
}
2019
console.log(capitalise("fares"));
21-
*/

0 commit comments

Comments
 (0)