Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a function called sortString that returns a passed string with letters in alphabetical order.
- Input:
- 'dcba'
- 'zycxbwa'
- Expected Output:
- 'abcd'
- 'abcwxyz' */
- function sortString(str) {
- return str.split('').sort().join('');
- }
- console.log(sortString('dcba'));
Add Comment
Please, Sign In to add comment