Why am i getting "urierror: uri malformed" in javascript?

Example:

decodeURIComponent("%");

This error is raised when using the global URI handling functions and passing malformed URIs.

Solution: Ensure the passed URI is correctly formatted and encoded.

decodeURIComponent("%25");  // Decodes to "%"

Beginner's Guide to JavaScript