Tell us what’s happening:
My code does not even pass task 1. It asks for a function called sortByYear.
Your code so far
const books = [
{
title: title1,
authorName: author1,
releaseYear: 2001
},
{
title: title2,
authorName: author2,
releaseYear: 2002
},
{
title: title3,
authorName: author3,
releaseYear: 2003
}
];
function sortByYear (book1, book2) {
if (book1.releaseYear > book2.releaseYear) {
return 1;
} else if (book1.releaseYear < book2.releaseYear) {
return -1;
}
return 0;
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Challenge Information:
Build a Book Organizer - Build a Book Organizer