What are the decodeURI() and encodeURI()?

What are the decodeURI() and encodeURI()?

1 Like

From MDN,
The encodeURI() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two “surrogate” characters).

The decodeURI() function decodes a Uniform Resource Identifier (URI) previously created by encodeURI() or by a similar routine.

You can use them when you want to send / receive dynamic values in your URL.