Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
encodeURIComponent(uriComponent)
uriComponent
A value representing an unencoded URI component.
A string.
encodeURIComponent("hello world, здраво!")
"hello%20world%2C%20%D0%B7%D0%B4%D1%80%D0%B0%D0%B2%D0%BE!"
// Compare with encodeURI:
print('encodeURIComponent:', encodeURIComponent("https://calcish.com?q=just a test"))
print('encodeURI:', encodeURI("https://calcish.com?q=just a test"))
encodeURIComponent: https%3A%2F%2Fcalcish.com%3Fq%3Djust%20a%20test
encodeURI: https://calcish.com?q=just%20a%20test