JS .filter

by Rodrigo

JavaScript

var books = [
	{title: 'Cool Book', id: 1, type: 'ebook'},
  {title: 'Second Book', id: 2, type: 'hardcover'},
  {title: 'Last Book', id: 3, type: 'ebook'}
];

const ebooks = books.filter(
	(book) => { 
  	return book.type == 'ebook';
  }
);

console.log(ebooks);