VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-urlsearchparams-foreach/

⇱ Node.js URLSearchParams.forEach() - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js URLSearchParams.forEach()

Last Updated : 2 Sep, 2022

In URLSearchParams interface, the foreach() method returns an iterator which allows to iterate through all values contained in this object with the help of a callback function. Syntax:

searchParams.forEach(callback);

Return: It does not return anything, used for invoking the function and iterating through it. Parameters: callback - Input the callback function that will be executed against each parameter, with the value of the parameter provided as its parameter. Example1: 

Output:

vala keya
valb keyb

Example2: 

Output:

par parval
foo fooval
bar barval

Supported Browsers:

  • Google Chrome
  • IE
  • Edge
  • Opera
  • Apple Safari
Comment
Article Tags:
Article Tags:

Explore