blob: 37e019e3da7a5c14d88e870f1f64de4c1886d48f (
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
68
69
70
71
72
|
---
title: Set.prototype.values()
slug: Web/JavaScript/Reference/Global_Objects/Set/values
translation_of: Web/JavaScript/Reference/Global_Objects/Set/values
---
<div>{{JSRef}}</div>
<p><code><strong>values()</strong></code> method는 <code>Set<font face="Arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;"> 객체에 요소가 삽입된 순서대로 각 요소의 값을 순환할 수 있는 </span></font></code><code>Iterator</code> 객체를 반환합니다.</p>
<p>The <strong><code>keys()</code></strong> method is an alias for this method (for similarity with {{jsxref("Map")}} objects); it behaves exactly the same and returns <strong>values</strong> of <code>Set</code> elements.</p>
<div>{{EmbedInteractiveExample("pages/js/set-prototype-values.html")}}</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><code><em>mySet</em>.values();
</code></pre>
<h3 id="Return_value">Return value</h3>
<p>A new <code><strong>Iterator</strong></code> object containing the values for each element in the given <code>Set</code>, in insertion order.</p>
<h2 id="Examples">Examples</h2>
<h3 id="Using_values()">Using <code>values()</code></h3>
<pre class="brush:js">var mySet = new Set();
mySet.add('foo');
mySet.add('bar');
mySet.add('baz');
var setIter = mySet.values();
console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); // "baz"</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('ES2015', '#sec-set.prototype.values', 'Set.prototype.values')}}</td>
<td>{{Spec2('ES2015')}}</td>
<td>Initial definition.</td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-set.prototype.values', 'Set.prototype.values')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("javascript.builtins.Set.values")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Set.prototype.entries()")}}</li>
</ul>
|