复制
收藏
提问
全网

[ { current: 104.54, timestamp: 1722223800000, // 2024-07-29 11:30:00, time: '2024-07-29 11:30:00' }, { current: 105.18, timestamp: 1722216600000, // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: 1722223802000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:02' }, { current: 106.18, timestamp: 1722223801000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:01' } ] 对这个数组处理,要求 1.根据timestamp时间排序 2.通过dayjs对timestamp转成HH:mm 3.转过之后的数据,timestamp有重复的,去重的时候,只保留current最大的一项,比如108.18 最后输出 [ { current: 105.18, timestamp: '09:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: '11:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, ]

501292be3
3个月前
全网
文档
学术
百科
知识库
时间不限
自动

理解问题[ { current: 104.54, timestamp: 1722223800000, // 2024-07-29 11:30:00, time: '2024-07-29 11:30:00' }, { current: 105.18, timestamp: 1722216600000, // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: 1722223802000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:02' }, { current: 106.18, timestamp: 1722223801000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:01' } ] 对这个数组处理,要求 1.根据timestamp时间排序 2.通过dayjs对timestamp转成HH:mm 3.转过之后的数据,timestamp有重复的,去重的时候,只保留current最大的一项,比如108.18 最后输出 [ { current: 105.18, timestamp: '09:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: '11:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, ]

已完成理解[ { current: 104.54, timestamp: 1722223800000, // 2024-07-29 11:30:00, time: '2024-07-29 11:30:00' }, { current: 105.18, timestamp: 1722216600000, // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: 1722223802000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:02' }, { current: 106.18, timestamp: 1722223801000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:01' } ] 对这个数组处理,要求 1.根据timestamp时间排序 2.通过dayjs对timestamp转成HH:mm 3.转过之后的数据,timestamp有重复的,去重的时候,只保留current最大的一项,比如108.18 最后输出 [ { current: 105.18, timestamp: '09:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: '11:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, ]

展开阅读网页

更简洁一些
转笔记
简洁
[ { current: 104.54, timestamp: 1722223800000, // 2024-07-29 11:30:00, time: '2024-07-29 11:30:00' }, { current: 105.18, timestamp: 1722216600000, // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: 1722223802000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:02' }, { current: 106.18, timestamp: 1722223801000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:01' } ] 对这个数组处理,要求 1.根据timestamp时间排序 2.通过dayjs对timestamp转成HH:mm 3.转过之后的数据,timestamp有重复的,去重的时候,只保留current最大的一项,比如108.18 最后输出 [ { current: 105.18, timestamp: '09:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: '11:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, ]
知识树
[ { current: 104.54, timestamp: 1722223800000, // 2024-07-29 11:30:00, time: '2024-07-29 11:30:00' }, { current: 105.18, timestamp: 1722216600000, // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: 1722223802000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:02' }, { current: 106.18, timestamp: 1722223801000, //2024-07-29 11:30:01, time: '2024-07-29 11:30:01' } ] 对这个数组处理,要求 1.根据timestamp时间排序 2.通过dayjs对timestamp转成HH:mm 3.转过之后的数据,timestamp有重复的,去重的时候,只保留current最大的一项,比如108.18 最后输出 [ { current: 105.18, timestamp: '09:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, { current: 108.18, timestamp: '11:30', // 2024-07-29 09:30:00 time: '2024-07-29 09:30:00' }, ]
如何使用dayjs处理时间戳
如何对数组进行时间排序
如何去除数组中的重复元素

以上内容由AI搜集生成,仅供参考

在线客服