aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/urlsearchparams/entries/index.html
blob: 4f10b1bb125c271d732cb5f213bea84c9447a6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title: URLSearchParams.entries()
slug: Web/API/URLSearchParams/entries
translation_of: Web/API/URLSearchParams/entries
---
<p>{{APIRef("URL API")}}{{SeeCompatTable}}</p>

<p>La méthode <code><strong>URLSearchParams.entries()</strong></code> retourne  un itérateur( {{jsxref("Iteration_protocols",'iterator')}}) permettant de parcourir les paires de clé/valeur contenues dans cet objet. La clé et la valeur de chaque paire est un objet  {{domxref("USVString")}} .</p>

<div class="note">
<p><strong>Note :</strong> This method is available in <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>.</p>
</div>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">searchParams.entries();</pre>

<h3 id="Return_value">Return value</h3>

<p>Returns an {{jsxref("Iteration_protocols","iterator")}}.</p>

<h2 id="Example">Example</h2>

<pre class="brush: js">// Create a test URLSearchParams object
var searchParams = new URLSearchParams("key1=value1&amp;key2=value2");

// Display the key/value pairs
for(var pair of searchParams.entries()) {
   console.log(pair[0]+ ', '+ pair[1]);
}
</pre>

<p>The result is:</p>

<pre>key1, value1
key2, value2</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('URL', '#urlsearchparams','entries() (as iterator&lt;&gt;)')}}</td>
   <td>{{Spec2('URL')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>


<p>{{Compat("api.URLSearchParams.entries")}}</p>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>Other URL-related interfaces: {{domxref("URL")}}, {{domxref("URLUtils")}}.</li>
</ul>