Skip to content

Commit a91b538

Browse files
committed
fixed function error in 0.js
1 parent be79dc0 commit a91b538

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • Sprint-2/1-key-errors

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
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("hello") {
8-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9-
return str;
10-
}
7+
// function capitalise("hello") {
8+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9+
// return str;
10+
// }
1111

1212
// Uncaught SyntaxError: Identifier 'str' has already been declared - meaning str should not have been used inside the function or the parameter of the function
1313
function capitalise(str) {
1414
let capitalisedStr = `${str[0].toUpperCase()}${str.slice(1)}`;
15-
return str;
15+
return capitalisedStr;
1616
}
17+
18+
console.log(capitalise("hello"));

0 commit comments

Comments
 (0)