Easy Tutorial
❮ Event Onerror Media Prop Attr Isid ❯

JavaScript unescape() Function


Definition and Usage

The unescape() function decodes a string encoded by escape().

Tip: Use the escape() function to encode a string.

Note: The unescape() function has been removed from Web standards, so it is recommended not to use this function. Instead, use decodeURI or decodeURIComponent.

Syntax

Parameter Description
string Required. The string to be decoded.

Browser Support

All major browsers support the unescape() function.


Tips and Notes

Note: unescape() should not be used for decoding URIs (Uniform Resource Identifiers). For decoding URIs, use the decodeURI() method.


Example

In this example, we will encode a string using escape() and then decode it using unescape():

var str = "Need tips? Visit tutorialpro!";
var str_esc = escape(str);
document.write(str_esc + "<br>");
document.write(unescape(str_esc));

❮ Event Onerror Media Prop Attr Isid ❯