JavaScript escape string | Get encoded string example

You can encode a string using the escape() function in JavaScript. It makes a string portable to be transmitted across any network to any computer that supports ASCII characters.


JavaScript escape string Using escape function

HTML example code, how to special character encoded with escape function

<!DOCTYPE html>


   document.write(escape("EyeHunt tuorial!!!"));


   document.write(escape("A tuorial site for develoeprs"));



JavaScript escape string

Note: Although escape() is not strictly deprecated (as in “removed from the Web standards”), it is defined in Annex B of the ECMA-262 standard, whose introduction states:

Note: This function only encodes the special characters, this function is depricated.
Exceptions: @ – + . / * _

Do comment if you have any doubts and suggestions on this JS escape topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.