Friday, September 19, 2025
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

Most Popular

Dominic
32302 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6666 POSTS0 COMMENTS
Nicole Veronica
11841 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11898 POSTS0 COMMENTS
Shaida Kate Naidoo
6781 POSTS0 COMMENTS
Ted Musemwa
7056 POSTS0 COMMENTS
Thapelo Manthata
6739 POSTS0 COMMENTS
Umr Jansen
6745 POSTS0 COMMENTS