JavaScript Escape / Unescape

Escapes or unescapes a JavaScript string removing traces of offending characters that could prevent interpretation.



Character Description Is replaced with
Backspace \b
Form feed \f
Newline \n
Carriage return \r
Single quote \'
Double quote \"
Backslash \\
Nul char \0
Vertical Tab \v
Horizontal Tab \t

What is JavaScript ?

Javascript is used by programmers across the world to create dynamic and interactive web content like applications and browsers. JavaScript is so popular that it's the most used programming language in the world, used as a client-side programming language by 97.0% of all websites. JavaScript is a programming language commonly used in web development. It was originally developed by Netscape as a means to add dynamic and interactive elements to websites. While JavaScript is influenced by Java, the syntax is more similar to C and is based on ECMAScript, a scripting language developed by Sun Microsystems. JavaScript is a client-side scripting language, which means the source code is processed by the client's web browser rather than on the web server. This means JavaScript functions can run after a webpage has loaded without communicating with the server. For example, a JavaScript function may check a web form before it is submitted to make sure all the required fields have been filled out. The JavaScript code can produce an error message before any information is actually transmitted to the server.

What are escape and unescape in JavaScript ?

The escape in JavaScript is used for encoding a string. Using ASCII character support, it makes a string portable so that it can be transmitted across any network to any computer. This takes a string as a single parameter & encodes the string that can be transmitted over the computer network which supports ASCII characters. Encoding is the process of converting plain text into ciphertext.
The unescape is used to decode that string encoded by the escape function, corresponding to the escapes.