urlSearchParams[Symbol.iterator]()


返回一个 ES6 Iterator,用于遍历查询字符串中的每个名称-值对。迭代器的每一项都是一个 JavaScript ArrayArray 的第一个元素是 name,第二个元素是 value

【Returns an ES6 Iterator over each of the name-value pairs in the query string. Each item of the iterator is a JavaScript Array. The first item of the Array is the name, the second item of the Array is the value.】

urlSearchParams.entries() 的别名。

【Alias for urlSearchParams.entries().】

const params = new URLSearchParams('foo=bar&xyz=baz');
for (const [name, value] of params) {
  console.log(name, value);
}
// Prints:
//   foo bar
//   xyz baz