# composition

[JS](../../..) ⟩ [objects](../../../val/obj) ⟩ [built-in](../../../val/builtin) ⟩ [Generator](..) ⟩ [generator function]() ⟩ compostion

{% tabs %}
{% tab title="✨ 範例" %}
* [zip](../examples/zip "mention") - <mark style="color:yellow;">**zip**</mark> [iterable](../../iterable "mention")s into a single [](<> "mention").
* [interleave](../examples/interleave "mention") - <mark style="color:yellow;">**interleave**</mark> the values of [iterable](../../iterable "mention")s.
* [seq](../examples/seq "mention") - yield values <mark style="color:yellow;">**sequentially**</mark>.
{% endtab %}

{% tab title="💈範例" %}
{% hint style="success" %}
syntax：<mark style="color:blue;">`yield* <generator object>`</mark>
{% endhint %}

⬆️ 需要： [list](../examples/list "mention")

```javascript
// ⭐️ composition of generator functions
function* alphaNumericCodes(){
    yield* list(26, {start: 97});   // a..z    // ⭐️ Note: use of `yield*`
    yield* list(26, {start: 65});   // A..Z
    yield* list(10, {start: 48});   // 0..9
}

// generator object -> array
[...alphaNumericCodes()]                 
    .map(n => String.fromCharCode(n))    // array of codes -> array of characters
    .join('')                            // 'a..zA..Z0..9'
```
{% endtab %}

{% tab title="📘 手冊" %}
*
{% endtab %}
{% endtabs %}
