function countStatistics() {
  let booksRead = myLibrary.reduce((total, book) => {
    if (book.read) total++;
    return total;
  }, 0);

  let booksUnread = myLibrary.reduce((total, book) => {
    if (!book.read) total++;
    return total;
  }, 0);

  let allBooks = myLibrary.length;

  return [booksRead, booksUnread, allBooks];
}
// function which iterates through myLibrary and returns statistics array
function which iterates through myLibrary and returns statistics array
function which iterates through myLibrary and returns statistics array
function countStatistics() {
  let booksRead = myLibrary.reduce((total, book) => {
    if (book.read) total++;
    return total;
  }, 0);
  let booksUnread = myLibrary.reduce((total, book) => {
    if (!book.read) total++;
    return total;
  }, 0);
  let allBooks = myLibrary.length;
  return [booksRead, booksUnread, allBooks];
}
function countStatistics ( ) { let booksRead = myLibrary . reduce ( ( total , book ) => { if ( book . read ) total ++ ; return total ; } , 0 ) ; let booksUnread = myLibrary . reduce ( ( total , book ) => { if ( ! book . read ) total ++ ; return total ; } , 0 ) ; let allBooks = myLibrary . length ; return [ booksRead , booksUnread , allBooks ] ; }
function which iterates through myLibrary and returns statistics array
function which iterates through myLibrary and returns statistics array