Reverse and Omit Non-alphabetic Characters

In this example below you will see how to do a Reverse and Omit Non-alphabetic Characters with some HTML / CSS and Javascript

Given a string (str), this function omits all non-alphabetic characters while reversing all other characters.

Thumbnail
This awesome code was written by izotope115, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright izotope115 ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/izotope115/reverse-and-omit-non-alphabetic-characters-aWWOeK */
    


/*Downloaded from https://www.codeseek.co/izotope115/reverse-and-omit-non-alphabetic-characters-aWWOeK */
    const reverseLetter = str => {
  let replace = str.replace(/[0-9]/g, "").replace(/[^a-zA-Z0-9]/g, "");
  replace = replace.split("").reverse().join("");

  return replace;
};

// reverseLetter("ultr53o?n"); "nortlu"
// using 'let' vs const becase we are re-assigning its value


Comments