Skip to content

Commit cb6bae6

Browse files
authored
Refactor capitalise_all_letters to use replaceAll
Updated the capitalise_all_letters function to use replaceAll for replacing spaces with underscores. Added additional console log for testing.
1 parent dbb267b commit cb6bae6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎Sprint-3/3-mandatory-implement/2-cases.js‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
function capitalise_all_letters(str) {
1919
//I used toUpperCase string method to capitalise all the string
2020
//I used replace to replace first space " " in the string and replace it with "_"
21-
return str.toUpperCase().replace(" ", "_");
21+
return str.toUpperCase().replaceAll(" ", "_");
2222
}
2323

24-
console.log(`The result is ${capitalise_all_letters("hello world")}`);
24+
console.log(
25+
`The result is ${capitalise_all_letters("hello world we are here")}`,
26+
);
2527

26-
// so far its easy -_-
28+
// so far its easy -_-
29+
//I used replaceAll to replace every space with _
30+
//I used Copilot like a teacher to help me when I'm stuck
31+
//one day I will create AI models -_-1

0 commit comments

Comments
 (0)