Encoding of URLs, which can replace invalid characters with special UTF-8 characters, thus allowing browsers to accept and understand them

Detail:

There are two functions in javascript.

1 encodeURI(): works on the entire URI, only spaces are replaced with %20, other special characters are left intact

2 encodeURIComponent() works on the string behind the existing URI, also encodes any non-standard characters, used more in development, such as multi-query string parameter encoding.