Skip to content

Commit 9fec1a6

Browse files
committed
Solve alphabetSoup
1 parent 3655b72 commit 9fec1a6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Alphabet_Soup.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Description: For this challenge you will be sorting characters in a string.
2+
3+
// Q. Have the function AlphabetSoup(str) take the str string parameter being
4+
// passed and return the string with the letters in alphabetical order
5+
// (ie. hello becomes ehllo). Assume numbers and punctuation symbols will
6+
// not be included in the string.
7+
8+
// Examples
9+
// Input: "coderbyte"
10+
// Output: bcdeeorty
11+
12+
// Input: "hooplah"
13+
// Output: ahhloop
14+
15+
const alphabetSoup = str => {
16+
return str
17+
.split('')
18+
.sort()
19+
.join('');
20+
};
21+
22+
console.log(alphabetSoup('programming'));

0 commit comments

Comments
 (0)