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");