w3resource logo


CoffeeScript exercises

CoffeeScript function: Returns a passed string with letters in alphabetical order

CoffeeScript Function : Exercise-11 with Solution

Write a CoffeeScript function that returns a passed string with letters in alphabetical order.

Example string : 'webmaster'
Expected Output : 'abeemrstw'

Note: Assume punctuation and numbers symbols are not included in the passed string.

Solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
</body>
</html>

CoffeeScript Code :

alphabet_order = (str) ->
  str.split('').sort().join ''

alert alphabet_order('webmaster')

Live Demo :

JS Bin on jsbin.com

Post your code through Disqus :



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program