File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Sprint-2/3-mandatory-implement Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+
12// A set of words can be grouped together in different cases.
23
34// For example, "hello there" in snake case would be written "hello_there"
1415// You will need to come up with an appropriate name for the function
1516// Use the MDN string documentation to help you find a solution
1617// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
18+
19+ function capSnakeCase ( str ) {
20+ const upper = str . toUpperCase ( ) ;
21+ const snake = upper . replace ( / / g, "_" ) ;
22+ return snake ;
23+ }
24+ console . log ( capSnakeCase ( "lord of the rings" ) ) ;
25+
26+ // step 1: get a string input
27+ //step 2: change the upper case
28+ //step 3: replace spaces with underscores
29+ // step 4: return capSnakeCase
You can’t perform that action at this time.
0 commit comments