Unescape

Updated: 11/16/2019 by Computer Hope
Unescape in white lettering on red background.

The unescape function is used in JavaScript to decode a string encoded using the encode function, or to decode other types of encoded strings, such as URLs. For example, the JavaScript below will encode and then decode a string.

var jif = "JavaScript is fun!";
var esc_jif = escape(jif);
document.write(esc_jif + "<br /><br />");
var unesc_jif = unescape(esc_jif);
document.write(unesc_jif);

This displays the following results.

JavaScript%20is%20fun%21
JavaScript is fun!
Tip

It should be noted, however, that the escape and unescape functions are not encouraged for future use in JavaScript. Instead, we recommend using the encodeURI or decodeURI functions.

Escape, Function, Programming terms