2 回答

TA貢獻1898條經驗 獲得超8個贊
let arr = [
{
value: [
2.54,
14.92,
3.5,
2.57,
1.64,
8.85,
5.59,
51.63,
3.02,
5.74
],
name: [
"input",
"output",
"initialization",
"pvtProperties",
"rockProperties",
"equationSetup",
"networkWells",
"solver",
"update",
"misc"
]
}
];
console.log(arr[0].value.map((v, i) => ({ value: v, name: arr[0].name[i] })));

TA貢獻1780條經驗 獲得超4個贊
不知道為什么每個value都是335,但這里是 -
const arr = [
{
"value":[
2.54,
14.92,
3.5,
2.57,
1.64,
8.85,
5.59,
51.63,
3.02,
5.74
],
"name":[
"input",
"output",
"initialization",
"pvtProperties",
"rockProperties",
"equationSetup",
"networkWells",
"solver",
"update",
"misc"
]
}
];
const data = arr[0].name.map(e => ({value: 335, name: e}));
console.log(data);
添加回答
舉報