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"

const decoded = decodeURI(encoded);

console.log(decoded);
// 출력: "https://www.example.com/?x=샘플 값"
decodeURI(encodedURI)
const encodedURI = "https://example.com/%EC%9D%B4%EB%A9%94%EC%9D%BC"; // 인코딩된 URI
const decodedString = decodeURI(encodedURI); // 디코딩된 문자열

console.log(decodedString); // 출력: "https://example.com/이메일"
const uriComponent = "https://www.example.com/search?q=JavaScript & Web Development";
const encodedUriComponent = encodeURIComponent(uriComponent);

console.log(encodedUriComponent);
// 출력: "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3DJavaScript%20%26%20Web%20Development"

const decodedUri = decodeURI(encodedUriComponent);

console.log(decodedUri);
// 출력: "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3DJavaScript %26 Web Development"
const uriComponent = "https://www.example.com/search?q=JavaScript & Web Development";
const encodedUriComponent = encodeURIComponent(uriComponent);
console.log(encodedUriComponent);
// 출력: "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3DJavaScript%20%26%20Web%20Development"

const decodedUri = decodeURIComponent(encodedUriComponent);
console.log(decodedUri);
// 출력: "https://www.example.com/search?q=JavaScript & Web Development"

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