More details
The encodeURIComponent() function encodes a URI by substituting each occurrence of specific characters with one, two, three, or four escape sequences, which represent the UTF-8 encoding of the character. (For characters composed of two surrogate characters, there will be four escape sequences.) Unlike encodeURI(), this function encodes a broader range of characters, encompassing those integral to the URI syntax.