const uri = "https://www.example.com/?x=샘플 값";
const encoded = encodeURI(uri);

console.log(encoded);
// 출력: "https://www.example.com/?x=%EC%83%98%ED%94%8C%20%EA%B0%92"
encodeURI(uri);
const uri = "https://example.com/search?query=Hello, world!&page=1";
const encodedUri = encodeURI(uri);

console.log(encodedUri);
// 출력: "https://example.com/search?query=Hello,%20world!&page=1"

caniuse.com에서 더 자세한 정보를 확인해 보세요.