Given this object (items per array is the same) :
{
force_x: [6, 7, 7],
force_y: [2, 3, 4],
timestamp: [0.08, 0.016, 0.024]
}
How could I use Javascript to create this for all keys except timestamp
:
{
{mode: "force_x", value: 6, timestamp: 0.08},
{mode: "force_x", value: 7, timestamp: 0.16},
{mode: "force_x", value: 7, timestamp: 0.24},
{mode: "force_y", value: 2, timestamp: 0.08},
{mode: "force_y", value: 3, timestamp: 0.16},
{mode: "force_y", value: 4, timestamp: 0.24},
}
Note that the timestamp
array can be removed from the object, if it's easier to handle. The algorithm should not specify the force_x
and force_y
keys and do it automatically for each keys.