【发布时间】:2019-01-17 04:05:57
【问题描述】:
我需要在下面给出的以下响应中获取最后一个“观察到”等于“观察到”的“num”值(例如“估计”之前的那个)。
return 每三个小时将下一个“估计”更新为“观察到”,每次请求 API 时我都需要显示更新后的“num”值。
非常感谢您的帮助。
axios.get('http://url_to_api')
.then(function (response) => {
//do the magic here to get last observed val
console.log(LAST_OBSERVED_VAL)
})
回应:
[
[
"time_tag",
"num",
"observed",
"scale"
],
[
"2019-01-16 18:00:00",
"2",
"observed",
null
],
[
"2019-01-16 21:00:00",
"3",
"observed",
null
],
[
"2019-01-17 00:00:00",
"3", // <-- Get this value
"observed",
null
],
[
"2019-01-17 03:00:00",
"2",
"estimated",
null
],
[
"2019-01-17 06:00:00",
"2",
"estimated",
null
],
[
"2019-01-18 00:00:00",
"2",
"predicted",
null
],
[
"2019-01-18 03:00:00",
"1",
"predicted",
null
],
]
【问题讨论】: