Skip to content

Commit 76d0588

Browse files
Avoid mutating function parameter
1 parent ab3d116 commit 76d0588

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function capitalise(str) {
2020
// This avoids the redeclaration error and the code runs correctly.
2121
// =============> write your new code here
2222
function capitalise(str) {
23-
str = `${str[0].toUpperCase()}${str.slice(1)}`;
24-
return str;
23+
const capitalised = `${str[0].toUpperCase()}${str.slice(1)}`;
24+
return capitalised;
2525
}
2626
let str = capitalise("Arun");
2727
console.log(str);

0 commit comments

Comments
 (0)