If you know the array is sorted and want to get the last item in the array, you can use the length property to calculate the index of the last item
e.g.
const latest = data[data.length -1];
3
solved how i can grab the latest json data in javascript? [closed]