function process(str) {
      return (
        str
          .replace(/^\/+/, '') // Remove slashes in the beginning
          .replace(/\/+$/, '') // Remove slashes in the end
        + '/'
      );
    }
// Return string with slash in the end
Return string with slash in the end
Return string with slash in the end
function process(str) {
      return (
        str
          .replace(/^\/+/, '') 
          .replace(/\/+$/, '') 
        + '/'
      );
    }
function process ( str ) { return ( str . replace ( / ^\/+ / , '' ) . replace ( / \/+$ / , '' ) + '/' ) ; }
Return string with slash in the end
Return string with slash in the end
// Remove slashes in the beginning // Remove slashes in the end