Latest web development tutorials

JavaScript unescape () function

Function Reference Manual JavaScript Global Functions

Definition and Usage

unescape () function through the escape () to decode the encoded string.

Tip: Use thefunction escape () string is encoded.

grammar

unescape(string)

参数 描述
string 必需。要解码的字符串。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support unescape () function.


Tips and Notes

Note: unescape () can not be used in for URI. (Universal Resource Identifier: UniformResourceIdentifier, referred to as the "URI") featured decoder to decode the URI Use decodeURI () method.


Examples

Examples

In this example, we will use the escape () to encode the string, and then use the unescape () decodes:

<script>

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

</script>

Examples of the above output:

Need%20tips%3F%20Visit%20W3Cschool%21
Need tips? Visit W3Cschool!

try it"


Function Reference Manual JavaScript Global Functions