1

A Fetch that i do returns this (everything in vanilla js):

Fetch return

now, i cant loop through it since it isn't an array, it's an object. what i did is stringify the result so i get:

{"Nurture":43,"Regrowth":31,"Music":37,"Blades":12,"Blunt":1}

What i want is put all values between " " in an array and all numbers in another array. or 1 nested array would also be fine.

  • 3
    Rather than stringifying your object, leave it as an object, and use `Object.keys()` to get the keys (ie: things between the double-quotes), and `Object.values()` to get your numbers. Not sure what you mean by one nested array, but maybe `Object.entries()` would work for that output. – Nick Parsons Jun 15 '22 at 12:29
  • 2
    ```Object.values(specializationsObj)``` Now you can get all the values – Ganesh MB Jun 15 '22 at 12:30
  • 1
    Yes! i figured out how it works Object.keys(out[0].specializations) and similar with values() will do it for me, thanks for the lightning fast responses – William Pylyser Jun 15 '22 at 12:51

0 Answers0