Skip to content

Commit 75b0d32

Browse files
committed
Change to upper snake case
1 parent 9b194a5 commit 75b0d32

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@
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 capSnakeCase(str) {
19+
const upper = str.toUpperCase();
20+
const snake = upper.replace(/ /g, "_");
21+
return snake;
22+
}
23+
console.log(capSnakeCase("lord of the rings"));
24+
25+
// step 1: get a string input
26+
//step 2: change the upper case
27+
//step 3: replace spaces with underscores
28+
// step 4: return capSnakeCase

0 commit comments

Comments
 (0)