Skip to content

Commit 49b8d14

Browse files
committed
Write a function that takes a string argument and converts it to UPPER_SNAKE_CASE
1 parent 97e074f commit 49b8d14

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,16 @@
1414
// You will need to come up with an appropriate name for the function
1515
// Use the MDN string documentation to help you find a solution
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
17+
18+
function convertToUpperSnakeCase(inputString) {
19+
// we need to find everywhere the character space is and replace it with an underscore
20+
// we need to convert the string from lowercase to uppercase
21+
const oldCharacterSpace = " ";
22+
const newCharacterUnderscore = "_";
23+
const findspaceAndReplace = inputString.replaceAll(oldCharacterSpace, newCharacterUnderscore);
24+
const convertToUpperCase = findspaceAndReplace.toUpperCase();
25+
return convertToUpperCase;
26+
}
27+
28+
const actualOutput = convertToUpperSnakeCase("how are you Tolu");
29+
console.log(actualOutput);

0 commit comments

Comments
 (0)