URL Enocde w JavaScript

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