The function escape("argument") converts the argument to a string and encodes it in a URL-encoded format.

Here, all alphanumeric characters are escaped with % hexadecimal sequences. For example,

escape("escape unescape");

gives as its output:


where %20 is space.

The function unescape converts all hexadecimal sequences to ASCII characters. For example,


produces as its output:

escape unescape
Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and cemented her lasting interest in the media, persuasion, and communications culture.

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.

No Reader comments

Related books & courses
Available now on SitePoint Premium

Preview for $1