I have a list of dates and EVI values and extracted the EVI values to find the highest one. However, when I iterate through the list, it won't print anything for the maxEViValue (every value in datatable is higher than -100). What's the problem?
This is my code:
// Initialize a variable to store the maximum EVI value
function findmaxEVI (){
var maxEVIValue = -100; // Start with a very small value
// Iterate through the datatable to find the maximum EVI value
for (var i = 0; i < 132; i++) {
var num = datatable.get(i);
var eviValue = ee.List(num).get(1); // Get the EVI value from the sublist
if (eviValue > maxEVIValue) {
maxEVIValue = eviValue; // Update the maximum if a larger value is found
print(maxEVIValue);
}
}
}
findmaxEVI();