function booksByColor(books) {
  const colors = {};

  books.forEach((book) => (colors[book.color] = []));
  books.forEach((book) => colors[book.color].push(book.title));

  // not a good solution but works

  return colors;
}
/**************************************************************
 * booksByColor(books):
 * - receives an array of books
 * - returns an object where the keys are colors
 *   and the values are arrays of book titles:
 *    { <COLOR>: [<BOOK_TITLES>] }
 ****************************************************************/
- receives an array of books
- returns an object where the keys are colors
and the values are arrays of book titles:
{ : [] }
- receives an array of books - returns an object where the keys are colors and the values are arrays of book titles : { : [] }
function booksByColor(books) {
  const colors = {};
  books.forEach((book) => (colors[book.color] = []));
  books.forEach((book) => colors[book.color].push(book.title));
  return colors;
}
function booksByColor ( books ) { const colors = { } ; books . forEach ( ( book ) => ( colors [ book . color ] = [ ] ) ) ; books . forEach ( ( book ) => colors [ book . color ] . push ( book . title ) ) ; return colors ; }
booksByColor(books):
 - receives an array of books
 - returns an object where the keys are colors
   and the values are arrays of book titles:
    { <COLOR>: [<BOOK_TITLES>] }
booksByColor ( books ) : - receives an array of books - returns an object where the keys are colors and the values are arrays of book titles : { <COLOR > : [ <BOOK_TITLES > ] }
// not a good solution but works