The escape() function encodes a string. It makes the string portable, so it can be transmitted over the network to any computer that supports ASCII characters. The escape() function can also encode some special characters. In this article, we will take a look at the specific use of the escape() function. .
Let’s take a look at the basic syntax of the escape function
escape(string)
Note: The escape() function can be used except , / ? : @ & = $ # . Special character encoding other than .
Let’s look at a specific example
The code is as follows
<!DOCTYPE html> <html> <head> <title>JavaScript String match() Method</title> </head> <body> <script type="text/javascript"> document.write(escape("Visit W3School!") + "<br />") document.write(escape("?!=()#%&")) </script> </body> </html>
The display effect on the browser is as follows
This article ends here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !
The above is the detailed content of How to use the escape function. For more information, please follow other related articles on the PHP Chinese website!