Как сортировать линии javascript

const sortLines = (string) => {
  const newText = string
    .split(/\r?\n/)
    .sort()
    .join("\n");
  
  return newText;
};
mrmalik610