title: Javascript ES6 Iterator protocol and forEach
body: <p>Currently I am sharpening my ES6 skills a bit. I am looking into Iterator/Generator-syntax. I have a working example of </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class Library {
      constructor(){
          this._books = [];
      }
      addBook(book){
          this._books.push(book);
      }
      get books() {
          return this._books;
      }
      *[Symbol.iterator]() {
          for(let i=0; i&lt;this._books.length; i++) {
              yield this._books[i];
          }
      }
  }
  
  l = new Library();
  l.addBook("Book1");
  l.addBook("Book2");
  
  for(let book of l){
      console.log(book);
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Where everything works fine. But my first approach was trying something like </p>
  
  <pre><code>*[Symbol.iterator]() {
      this._books.forEach(
          book =&gt; yield book
      )
  }
  </code></pre>
  
  <p>Which is (obviously) not correct. Is there besides looping with <code>for</code> or <code>while</code> a more concise way, to write this?</p>