aboutsummaryrefslogtreecommitdiff
path: root/files/tr/web/javascript/reference/operatörler/function_star_/index.html
blob: 193e00f2056333667397356e6e5c4b462ef2ca13 (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
73
74
75
76
77
78
79
80
81
82
83
84
---
title: function* expression
slug: Web/JavaScript/Reference/Operatörler/function*
translation_of: Web/JavaScript/Reference/Operators/function*
---
<div>{{jsSidebar("Operators")}}</div>

<p>The <strong><code>function*</code></strong> keyword can be used to define a generator function inside an expression.</p>

<div>{{EmbedInteractiveExample("pages/js/expressions-functionasteriskexpression.html")}}</div>



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

<pre class="syntaxbox">function* [<em>name</em>]([<em>param1</em>[, <em>param2[</em>, ..., <em>paramN</em>]]]) {
   <em>statements</em>
}</pre>

<h3 id="Parametreler">Parametreler</h3>

<dl>
 <dt><code>name</code></dt>
 <dd>The function name. Can be omitted, in which case the function is <em>anonymous</em>. The name is only local to the function body.</dd>
 <dt><code>paramN</code></dt>
 <dd>Argüman adıdır, bir fonksiyon maxiumum 255 argüman alır.</dd>
 <dt><code>statements</code></dt>
 <dd>Fonksiyon kodları.</dd>
</dl>

<h2 id="Açıklama">Açıklama</h2>

<p>A <code>function*</code> expression is very similar to and has almost the same syntax as a {{jsxref('Statements/function*', 'function* statement')}}. The main difference between a <code>function*</code> expression and a <code>function*</code> statement is the <em>function name,</em> which can be omitted in <code>function*</code> expressions to create <em>anonymous</em> generator functions. See also the chapter about <a href="/en-US/docs/Web/JavaScript/Reference/Functions">functions</a> for more information.</p>

<h2 id="Örnekler">Örnekler</h2>

<p>Aşağıdaki adlandırılmamış fonksiyondur ve gelen değer karesini verir.</p>

<pre class="brush: js">var x = function*(y) {
   yield y * y;
};
</pre>

<h2 id="Özellikler">Özellikler</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', '#', 'function*')}}</td>
   <td>{{Spec2('ES2015')}}</td>
   <td>Initial definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#', 'function*')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Tarayıcı_uyumluluğu">Tarayıcı uyumluluğu</h2>



<p>{{Compat("javascript.operators.function_star")}}</p>

<h2 id="Bakabilirsiniz">Bakabilirsiniz</h2>

<ul>
 <li>{{jsxref("Statements/function*", "function* statement")}}</li>
 <li>{{jsxref("GeneratorFunction")}} object</li>
 <li><a href="/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol">The Iterator protocol</a></li>
 <li>{{jsxref("Operators/yield", "yield")}}</li>
 <li>{{jsxref("Operators/yield*", "yield*")}}</li>
 <li>{{jsxref("Function")}} object</li>
 <li>{{jsxref("Statements/function", "function statement")}}</li>
 <li>{{jsxref("Operators/function", "function expression")}}</li>
 <li>{{jsxref("Functions_and_function_scope", "Functions and function scope")}}</li>
</ul>