URL Enocde в JavaScript

const urlEncoded = (string) => {
  const newText = encodeURI(string);
  return newText
};
mrmalik610