'What is the most efficient way to get data out of the following JSON object as two separate arrays?

What is the most efficient way to get data out of the following JSON object as two separate arrays?

let dates = [];
let values = [];

For example, I want to get [0] index values from each array and save to a dates Arr, and [1] index values and save to a values Arr.

Is there a way to destructure the object and assign variables to each element? or would a for loop within a forEach() function be the best approach?

Obj {
"data": [
    [
      "1947-01-01",
      243.1
    ],
    [
      "1947-04-01",
      246.3
    ],
    [
      "1947-07-01",
      250.1
    ],
    [
      "1947-10-01",
      260.3
    ]
}

Note: The JSON object is being retrieved through a fetch API call.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source