# make iterator iterable

[JS](../..)⟩ [iteration](..) ⟩ [iterator]() ⟩ make iterator iterable

{% hint style="success" %}
an [](<> "mention") can be made [iterable](../iterable "mention") by making it <mark style="color:yellow;">**return itself**</mark> in the [make-iterator-method](../iterable/make-iterator-method "mention").
{% endhint %}

{% tabs %}
{% tab title="💈範例" %}
```javascript
const iterator = {

  // ⭐️ iterator must have `next()` method
  next() {
    // return iteration result ...
  },
  
  // ⭐️ iterable must have "make iterator" method
  [Symbol.iterator] () { 
      // because `iterator` is itself an iterator,
      // we can simply return itself. ⭐️ 
      return this;
  },
  
};
```
{% endtab %}

{% tab title="📘 手冊" %}
* [Iteration protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)
{% endtab %}
{% endtabs %}
