Jak sortować linie w JavaScript

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