数组:
data= [
{id: 10061, name: "小明", fatigue: 30, focus: 79, relax: 36, created: "2021-07-13 17:31:02"},
{id: 10159, name: "小李 fatigue: 24, focus: 47, relax: 58, created: "2021-07-13 17:31:03"},
{id: 10061, name: "小明", fatigue: 30, focus: 86, relax: 53, created: "2021-07-13 17:31:07"},
{id: 10159, name: "16710240102", fatigue: 18, focus: 45, relax: 51, created: "2021-07-13 17:31:08"}
]
希望得到的结构是:根据参数获得数组中是每个人的created和fatigue或focus或relax组成的二维数组数组
获取fatigue
data = [{[[2021-7-13 17:31:02",30],["2021-07-13 17:31:07", 30]]},
{[[2021-7-13 17:31:03",24],["2021-07-13 17:31:08", 18]]}
]
你期望的数据结构不符合javascript的要求,如果是字符串的还行,如果需要内存对象的,这个是不符合要求的,可能需要调整为如下的多维数组格式:
这样的话,就是一个根据ID过滤提取,再组合的情况。