JSFiddle - React, Tailwind, and code Playground

by Julian Garcia Castillo

JavaScript

let books = [{id:1, name:"a", date: 12},{id:2, name:"v", date: 4}, {id:3, name:"gr", date: 5}]


var orderedDates = books.sort(function(a, b) {
  return a.date - b.date;
});


books.findIndex(b => b.id == bookId)


console.log(orderedDates[0]);