encodeURIComponent()???JavaScript????????,????????URL?????????URL??????????????????,??????URL?????
encodeURIComponent()???????:
encodeURIComponent(str)
??,str????URL???????
??:
var url = "https://www.example.com?q=hello world"; var encodedUrl = encodeURIComponent(url); console.log(encodedUrl); // ??:https://www.example.com?q=hello world
???????,???URL?????????,??encodeURIComponent()???URL?????,??????URL?????