Guest User

Untitled

a guest
Feb 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. var inputs = "hoge; fuga; aaa ; bbb";
  2.  
  3. // Split the input to an array and trim each element
  4. var tags = inputs.split(';').map(
  5. Function.prototype.call.bind(
  6. String.prototype.trim
  7. ));
  8.  
  9. // Concat sorted elements
  10. var output = tags.sort().join("; ");
  11.  
  12. console.log(output);
Add Comment
Please, Sign In to add comment