Get specific data from array based on date or highest id

Fun problem (i'm still learning JS). What about sort the array on reverse date order and take the first instance?

{{ean.data[i].tracked_products.sort(
     (p1, p2) => 
      {return p2.created_at - p1.created_at}
     )[0].stock
}}

hth