![]() |
VOOZH | about |
The querystring.encode() method is used to produce a URL query string from the given object that contains the key-value pairs. The method iterates through the object’s own properties to generate the query string.
It can serialize a single or an array of strings, numbers, and boolean. Any other types of values are coerced to empty strings.
During serializing, the UTF-8 encoding format is used to encode any character that requires percent-encoding. To encode using an alternative character encoding, the encodeURIComponent option has to be specified.
Syntax:
querystring.encode( obj, sep, eq, options )
Parameters: This function accepts four parameters as mentioned above and described below:
Return Value: It returns a String that contains the URL query produced from the given object.
Example 1:
Output:
👁 ImageExample 2:
Output:
👁 Image