Node | URLSearchParams.entries()
In URLSearchParams interface, the entries() method returns an iterator which allows to iterate through all the key/value pairs present in the object.The key/value are USVString objects.
Syntax:
searchParams.entries();
Return:iterator, iterating over all key-value pairs.
Example 1:
// Create a test URLSearchParams object var searchpar = new URLSearchParams("keya=vala&keyb;=valb"); // Display the key/value pairs for(var pair of searchpar.entries()) { console.log(pair[0]+ ', '+ pair[1]); } |
chevron_right
filter_none
Output:
keya, vala keyb, valb
Example 2:
// Create a test URLSearchParams object var searchpar = new URLSearchParams("par=parval&foo;=fooval&bar;=barval"); // Display the key/value pairs for(var pair of searchpar.entries()) { console.log(pair[0]+ ', '+ pair[1]); } |
chevron_right
filter_none
Output:
par, parval foo, fooval bar, barval
Supported Browsers:
- Google Chrome
- IE
- Edge (partial)
- Opera
- Apple Safari
Recommended Posts:
- Node.js | NPM (Node Package Manager)
- Why Node.js ?
- Node js | OS
- PHP vs. Node.js
- Node | URL.password API
- Node | URL.pathToFileURL API
- Node | URL.fileURLToPath API
- Node | URLSearchParams.set()
- Node | URL.resolve(from,to) API
- Node | URL.search API
- Node | URL.username API
- Node | URL.port API
- Routing in Node.js
- Node | URL.origin API
- Node | URL.host API
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



