I have such an Object freq = { a: 50, r: 25, m: 25 } I want to convert it to this Array-Object like thing
freq = { a: 50, r: 25, m: 25 }
Try this, I think it is the most performant way to do it, because .map() is slower than simple for loop:
.map()
for
let freq = { a: 50, r: 25, m: 25 } ; let dps = []; for (let prop in freq) { dps.push({ label: prop, y: freq[prop] }); } console.log(dps);