Updated: 10/17/2017 by Computer Hope

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);

This displays the results shown below.


JavaScript is fun!

It should be noted, however, that the escape and unescape functions are not encouraged for future use in JavaScript. Instead, it is recommended to use the encodeURI or decodeURI functions.

Escape, Function, Programming terms