Javascript 如何使用OpenWeatherMapAPI返回每天的最低和最高温度

Javascript 如何使用OpenWeatherMapAPI返回每天的最低和最高温度,javascript,Javascript,我使用的API与此API相同: 我正在尝试获取数据,但我不知道如何分别筛选每天的数据响应 这就是我想做的: fetch( "https://api.openweathermap.org/data/2.5/forecast/daily?q=Belgrade&&units=metric&cnt=7&appid=...." ) .then((response) => response.json()) .then((response)

我使用的API与此API相同:

我正在尝试获取数据,但我不知道如何分别筛选每天的数据响应

这就是我想做的:

fetch(
  "https://api.openweathermap.org/data/2.5/forecast/daily?q=Belgrade&&units=metric&cnt=7&appid=...."
)
  .then((response) => response.json())
  .then((response) => {
    for (var i=0; i<response.length; i++)
    for (var temp in response[i]) {
        console.log("Min temp: "+response[i][temp].min);
        console.log("Max temp: "+response[i][temp].max);
    }
})

我假设
I
是日偏移量,
response[I]
是一组温度(每小时或任何时间),它们是数字(而不是字符串)。然后:

“最小值:”+
响应[i]。减少((最小值,num)=>((num((num>最大值)?(num):(最大值)))

查看我昨天的回复:请不要在Stack Exchange站点中创建重复的帐户。请不要在Stack Exchange站点中创建重复的帐户。我假设
I
是日偏移量,
response[I]
是一个温度数组(每小时或任何时间),是数字(而不是字符串)。然后:
“min:”+回答[i].reduce((min,num)=>((num((num>max);(num):(max))
好吗?它有效吗/回答您的问题吗?如果有效,请选择并向上投票。谢谢!
Day: Today
Min_temp: 16
Max_temp: 20

Day: Tomorrow
Min_temp: 15
Max_temp: 21
"min: "+
response[i].reduce((min, num)=>((num<min)?(num):(min)))+
"<br>"+
"max: "+
response[i].reduce((max, num)=>((num>max)?(num):(max)))