Skip to content

JavaScript escape string | Get encoded string example

  • by

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 deprecated.
Exceptions: @ – + . / * _

Do comment if you have any doubts or 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

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading