Why do i get 'uncaught urierror: uri malformed'?

Example:

decodeURIComponent('%');
Solution:

This error occurs when `decodeURIComponent` encounters a malformed URI sequence. Ensure the input string to `decodeURIComponent` is a valid encoded URI component.


let encodedStr = encodeURIComponent('Hello World');
let decodedStr = decodeURIComponent(encodedStr);

Beginner's Guide to JavaScript