我已经使用map在reactjs中创建了两个数组。第一个是使用javascript中的地图创建两个数组的数组
const hey = portfolioSectorsPie.map(sector => sector.subtotal);
const hello = portfolioSectorsPie.map(sector => sector.percentage)
哎格式=的招呼[22, 23, 25]
格式= [22.35, 22.67, 25.90]
我想创建具有以下格式的数组:
finalArr = [22, 23, 25]
(22.35)% (22.67)%, (25.90)%
这可能是混乱,但想象像这样的数组[22(22.35)%, 23(22.67)%, 25(25.90)%]
与百分比下降的元素嘿。有任何想法吗?
'[22(22.35)%,23(22.67)%,25(25.90)%]'这是你的数组,你需要得到'[22,23,25 ],[22.35,22.67,25.90]'? – Oen44
不清楚它是什么意思'[22,23,25](22.35)%(22.67)%,(25.90)%或者[22(22.35)%,23(22.67)%,25(25.90)%] '。 – dfsq
不,我想创建一个包含这两个值的数组。另外我想第二个值在第一个值下,但我无法正确写入。 – user7334203