gpt4 book ai didi

javascript - 搜索对象数组,最近值缺失/值报告为错误

转载 作者:行者123 更新时间:2023-12-03 04:14:31 25 4
gpt4 key购买 nike

我有一个对象数组,我希望返回每个条目的时间戳值。我使用的方法如下:

function popGraph() {
jQuery(globalData).each(function(i, item) {
console.log(item.uID, item.timeStamp)
});
}

但是,它似乎没有返回大部分最新数据。返回的最新值是 timeStamp: 1484747211,但数据中的最新条目是 timeStamp:14957862831

控制台似乎还说每个 console.log 都是一个错误:

19455746_3_10 1483388143.76518  scripts.js:37:7

数组示例:

[{"blobJson":"x","deviceMfg":10,"eventCode":1,"sensorClass":3,"sensorUUID":"19455746","timeStamp":1.495786283580328E9,"uID":"19455746_3_10"},
{"blobJson":"x","deviceMfg":10,"eventCode":1,"sensorClass":3,"sensorUUID":"19455746","timeStamp":1.495786282578029E9,"uID":"19455746_3_10"},
{"blobJson":"x","deviceMfg":10,"eventCode":1,"sensorClass":3,"sensorUUID":"19455746","timeStamp":1.495786281072998E9,"uID":"19455746_3_10"}]

最佳答案

这是一个适合您的 fiddle :https://jsfiddle.net/e17p6vqb/8/

function popGraph(o) {
$.each(o,function(i, item) {
if(i >= 50){
return false;
}
console.log(item.uID, item.timeStamp);
});
}

var tmp = [{blobJson:"x",deviceMfg:10,eventCode:1,sensorClass:3,sensorUUID:"19455746",timeStamp:1.495786283580328E9,uID:"19455746_3_10"}];


popGraph(tmp);

关于javascript - 搜索对象数组,最近值缺失/值报告为错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44198706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com