urlSearchParams.forEach(fn[, thisArg])
-
fn
<Function> 为查询中的每个名称-值对调用¥
fn
<Function> Invoked for each name-value pair in the query -
thisArg
<Object> 在调用fn
时用作this
值¥
thisArg
<Object> To be used asthis
value for whenfn
is called
迭代查询中的每个名称-值对并调用给定的函数。
¥Iterates over each name-value pair in the query and invokes the given function.
const myURL = new URL('https://example.org/?a=b&c=d');
myURL.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURL.searchParams === searchParams);
});
// Prints:
// a b true
// c d true