![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
encodeURIComponent() function in JavaScript
The encodeURIComponent() function accepts a string value representing an URI and encodes it by replacing the characters in it using numbers (1 to 4) and escape sequence.
Syntax
Its Syntax is as follows
encodeURIComponent('http://www.qries.com/');
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var result1 = encodeURIComponent('http://www.qries.com/'); document.write(result1); document.write("<br>"); var result2 = encodeURIComponent('http://www.tutorialspoint.com/'); document.write(encodeURIComponent(result2)); </script> </body> </html>
Output
http%3A%2F%2Fwww.qries.com%2F http%253A%252F%252Fwww.tutorialspoint.com%252F
Advertisements