Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var inputs = "hoge; fuga; aaa ; bbb";
- // Split the input to an array and trim each element
- var tags = inputs.split(';').map(
- Function.prototype.call.bind(
- String.prototype.trim
- ));
- // Concat sorted elements
- var output = tags.sort().join("; ");
- console.log(output);
Add Comment
Please, Sign In to add comment