Easy Tutorial
❮ Prop Style Paddingleft Prop Audio Readystate ❯

JavaScript escape() Function


Definition and Usage

The escape() function encodes a string so that it can be read on any computer.

This method does not encode ASCII letters and numbers, nor does it encode the following ASCII punctuation marks: * @ - _ + . / . All other characters are replaced with escape sequences.

Tip: Use the unescape() method to decode a string.

Note: The escape() function has been removed from Web standards, so it is recommended not to use this function. Use encodeURI or encodeURIComponent instead.

Syntax

Parameter Description
string Required. The string to be escaped or encoded.

Browser Support

All major browsers support the escape() function.


Tips and Notes

Note: The escape() function should not be used for encoding URIs (Uniform Resource Identifiers). Use the encodeURI() function instead.


Example

Encode a string using escape():

The output of the above example:

Need%20tips%3F%20Visit%20tutorialpro%21

❮ Prop Style Paddingleft Prop Audio Readystate ❯