Function to remove special character

I am new in programming. I need an example for a funciton that I need to do to learn. The function is below.

  • a function that accepts input from a user.
  • Then when the user submits this function will return a sorted arrangement that removes allspaces and symbols
  • then sorts ascending for alphabets on the left side and sorts descending for numerics.

Can I do all this in one string? better to be in HTML or JS? I need to see any.