Level 55
@snowrancruzick something like
data.reduce((a, v) => ({ ...a, [v.country]: {value: v.total}}), {})
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a array of objects data in
const data = [ { total: 9, country: 'IN' }, { total: 0, country: 'AF' ]}; But all i need to convert above data into countries Map(plugin) format
data = {IN: { value: 9 },AF: { value: 0}}; Is there any possibilities https://shagle.download converting into this format.
Please help https://omegle.ws me in these issue.
Thanks in Advance
Please or to participate in this conversation.