0
I have the following code that will bring me an undetermined list; for example 5 items. I would like to return only the last item from the list.
for(var i = 0; i < data.list.length; i++){
if(Date.parse(data.list[i].date) >= dateA){
console.log(data.list[i].date);
}
Fernando, in the comments you say you want to catch a date longer than "today", but the question says you want to catch the last item. This is contradictory. Explain well in the question what you really want.
– Sam
Possible duplicate of How to return the last record of an array with Javascript or jQuery?
– Marconi
Possible duplicate of Return the last Array date
– NoobSaibot