encodeURIComponent() is a JavaScript function used to encode URIs. It encodes special characters like: , / ? : @ & = + $ #.
encodeURIComponent() can have a single parameter:
uri: the URI to be encoded.
Returns the encoded URI.
This will encode the given URI.