Friday, May 8, 2026
HomeLanguagesJavascriptNode.js URLSearchParams.entries()

Node.js URLSearchParams.entries()

In the URLSearchParams interface, the entries() method returns an iterator that allows iterating through all the key/value pairs present in the object. The key/value is USVString objects. 

Syntax:

searchParams.entries();

Return: Iterator, iterating over all key-value pairs. 

Example 1: 

javascript




// Create a test URLSearchParams object
const searchpar = new URLSearchParams("keya = vala&keyb = valb");
 
// Display the key/value pairs
for (let pair of searchpar.entries()) {
    console.log(pair[0] + ', ' + pair[1]);
}


Output:

keya, vala
keyb, valb

Example 2: 

javascript




// Create a test URLSearchParams object
const searchpar = new URLSearchParams("par = parval & foo = fooval &  bar = barval");
 
// Display the key/value pairs
for (let pair of searchpar.entries()) {
    console.log(pair[0] + ', ' + pair[1]);
}


Output:

par, parval
foo, fooval
bar, barval

Supported Browsers:

  • Google Chrome
  • Firefox
  • Edge (partial)
  • Opera
  • Apple Safari
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6962 POSTS0 COMMENTS