paragraf ke satu baris di javascript

const paraToSingleLine = (string) => {
  const newText = string.replace(/\s+/g, " ");
  return newText
};
mrmalik610