Javascript 数组的重排序对象

Javascript 数组的重排序对象,javascript,lodash,Javascript,Lodash,我有一个由多个数组组成的对象,这些数组共享时间序列中事件的公共属性: { time: [1522513800000, 1522515600000, 1522517400000, 1522519200000] event: ['foo', 'bar', 'some', 'thing'] notes: ['', 'not foo', 'sum', ''] } 我想将此对象重新排序(重新排列?)为一个对应值的数组,如下所示: [[1522513800000, 'foo', ''], [1

我有一个由多个数组组成的对象,这些数组共享时间序列中事件的公共属性:

{
  time: [1522513800000, 1522515600000, 1522517400000, 1522519200000]
  event: ['foo', 'bar', 'some', 'thing']
  notes: ['', 'not foo', 'sum', '']
}
我想将此对象重新排序(重新排列?)为一个对应值的数组,如下所示:

[[1522513800000, 'foo', ''], [1522515600000, 'bar', 'not foo'], [1522517400000, 'some', 'sum'], [1522519200000, 'thing', '']]

我更喜欢香草/ES6解决方案,但如果可行的话,我会在本项目中使用lodash。

首先将其转换为数组,然后使用
。排序

const输入={
时间:[15225138000000、152251560000、1522517400000、1522519200000],
事件:['foo','bar','some','thing'],
注:[''非富','求和','']
};
const numItems=input.time.length;
const items=Array.from({length:numItems},(\ux,i)=>([
输入时间[i],
input.event[i],
输入.注释[i],
]));
items.sort((itemA,itemB)=>itemB.time-itemA.time);

控制台日志(项目)首先将其转换为数组,然后使用
.sort

const输入={
时间:[15225138000000、152251560000、1522517400000、1522519200000],
事件:['foo','bar','some','thing'],
注:[''非富','求和','']
};
const numItems=input.time.length;
const items=Array.from({length:numItems},(\ux,i)=>([
输入时间[i],
input.event[i],
输入.注释[i],
]));
items.sort((itemA,itemB)=>itemB.time-itemA.time);

控制台日志(项目)对象中缺少一些
。。。不管怎样,你试过什么?
blah.time.map((time,index)=>[time,blah.event[index],blah.notes[index])对象中缺少一些
。。。不管怎样,你试过什么?
blah.time.map((time,index)=>[time,blah.event[index],blah.notes[index])