So sortieren Sie Linessin JavaScript

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