Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
split文字列を配列に入れ、並べ替えてから、元joinに戻します。
split
join
var textarea = document.getElementById("theTextareaId"); // or whatever... textarea.value = textarea.value.split("\n").sort().join("\n");